Инструменты пользователя

Инструменты сайта


en:api:air-lay

Air Lay


Раздел в процессе разработки

Структура запроса

    /**
    * api/v2/{controller}/{action}?{parameter1=value&parameter1=value&...}
    * Где
    * controller - контролер в котором производится действие,
    * action - действие контроллера,
    * parameter1, parameter2 ...  - параметры запроса,
    * value1, value2 ... - значение параметров
    */

API

    /**
    * api/{action}
    * Где action функция контроллера
    */
    /**
     * Вход пользователя через name и password
     * @return JWT
     */
    public function authAction()
 
    /**
     * Регистрация пользователя необходимые параметры
     * string name 
     * string password 
     * string email в формате example@mail ~
     */
    public function registrationAction()
 
    /**
     * Action for get menu
     * @return object free trees and private trees
     */
    public function getMenuAction()
 
    /**
     * Action for create tree. You can see JSON object descriptions below for more details.
     * @name string Name tree
     * @return object tree mongoDB object
     */
    public function createTreeAction()
 
    /**
     * Action for create Node(layerEntity/map/dir). You can see JSON object descriptions below for more details.
     * @name string Node name
     * @type string type of the node. Values : layerEntity/map/dir
     * @treeId ObjectId
     * @parentId ObjectId parent of the node
     * @order order in the parent's childs. default -1
     * @return array ['node'=> nodeInfo]
     */
    public function createNodeAction()  
 
    /**
     * Action for upload objects.
     * @layerId object Layer Id
     * @file file New objects
     * @treeId object Tree Id
     * @return string 200 Ok
     * 400 code 0 Need layerId, file, treeId
     * 400 code 1 File have is not correct type
     * 403 если пользователь не может изменить дерево
     * 400 code 2 слой не найден
     */
    public function uploadLayerAction()
 
    /**
     * Action for changing node name.
     * @treeId string ObjectId
     * @nodeId string ObjectId
     * @name string node name
     * @return string 200 Ok
     */
    public function updateNodeNameAction()
 
    /**
     * Action for changing node parent or order.
     * @treeId string ObjectId
     * @nodeId string ObjectId
     * @newParentId string ObjectId
     * @order string order number of node in new parent
     * @return string 200 Ok
     */
    public function moveNodeAction()
 
    /**
     * Action for removing node.
     * @treeId object Layer Id
     * @nodeId object Layer Id
     * @return string 200 Ok
     */
    public function removeNodeAction()
 
    /**
     * Action for changing node name.
     * @treeId string ObjectId
     * @nodeId string ObjectId
     * @name string node name
     * @return string 200 Ok
     */
    public function updateNodeNameAction()
 
    /**
     * Action for group creation.
     * @name string group name
     * @return string 200 Ok
     */
    public function createGroupAction()
 
    /**
     * Action for update group settings.
     * @id ObjectId group id
     * @name string new group name
     * @return string 200 Ok
     */
    public function updateGroupNameAction()
 
    /**
     * Action for update group settings.
     * @treeId ObjectId tree which to add
     * @groupId ObjectId group where to add
     * @return string 200 Ok
     */
    public function addTreeToGroupAction()
 
    /**
     * Action for update group settings.
     * @treeId ObjectId tree which to remove
     * @groupId ObjectId group where to remove
     * @return string 200 Ok
     */
    public function removeTreeFromGroupAction()
 
    /**
     * Action return user groups.
     * @return string 200 Ok
     */
    public function getUserGroupsAction()
 
    /**
     * Action for adding user to group.
     * @userId string ObjectId.
     * @groupId string ObjectId.
     * @return string 200 Ok
     */
    public function addUserToGroupAction()
 
     /**
     * Action set user/tree permissions for group
     * @id string ObjectId
     * @groupId string ObjectId
     * @permissions string group_mask
     * @entityName string 'trees'/'users'
     * @return string 200 Ok
     */  
    public function setGroupPermissionsAction()
 
    /**
     * Action for deleting user from group.
     * @userId string ObjectId.
     * @groupId string ObjectId.
     * @return string 200 Ok
     */
    public function deleteUserFromGroupAction(){
 
    /**
     * Action remove user groups.
     * @id string ObjectId
     * @return string 200 Ok
     */
    public function removeGroupAction()
 
    /**
     * POST
     * Action for product creation.
     * @title string group name **necessarily**
     * @type string **necessarily**
     * @treetIds/@file json array ObjectId of entities which is trees or file with product in zip format **necessarily**
     * @groupId if owner of the group
     * @description string product description
     * @shortDescription string product short description
     * @access int interaction_mask
     * @icon string base64 icon
     * @cost int product cost, default 0, not used at the moment.
     * @translation string json product translations, example {"ru":{"title":"Заголовок", "description": "описание на русском", ...}, "en":{...}}
     * @return string 200 Ok
     */
    public function createProductAction()
 
    /**
     * GET
     * Action for get product information.
     * @productId string ObjectId of entity which is product
     * @return string 200 product information
     */
    public function getProductAction()
 
    /**
     * GET
     * Action return all available product, excluding users products.
     * Filters: 
     * @access int interaction_mask, 
     * @type string (tree/map), 
     * @point json {"lon":86.696379, "lat":54.153597}
     * @return string 200 product information
     */
    public function getProductsAction()
 
    /**
     * GET
     * Action for purchase product
     * @productId string ObjectId of entity which is product
     * @return string 200 OK
     */
    public function purchaseProductAction()
 
    /**
     * POST
     * Action for product update.
     * @productId string ObjectId of entity which is product **necessarily**
     * @title string product name
     * @treeIds json array ObjectId trees
     * @file file in zip format
     * @description string product description
     * @shortDescription string product short description
     * @access int interaction_mask
     * @icon string base64 icon
     * @cost map string - double.
     * @translation string json product translations, example {"ru":{"title":"Заголовок", "description": "описание на русском", ...}, "en":{...}}
     * @return string 200 Ok
     */
    public function updateProductAction()
 
    /**
     * GET
     * Action for product remove from user or from bd if user is owner.
     * @productId string ObjectId of entity which is product
     * @return string 200 Ok
     */
    public function removeProductAction()
 
    /**
     * GET
     * Action for product get version.
     * @productId string ObjectId of entity which is product
     * @return string 200 product version
     */
    public function getProductVersionAction()    
 
    /**
     * Action for get user products
     * return string 200 user products
     */
    public function getUserProductsAction()
 
    /**
     * GET
     * @text string feedback text
     * @productId ObjectId product id
     * @return string 200 Ok
     */
    public function postFeedbackAction()
 
    /**
     * GET
     * @productId ObjectId product id
     * @return array 200 product feedback
     */
    public function getProductFeedbackAction()
 
    /**
     * GET
     * Action for get product file
     * @productId ObjectId product id
     * @return product file
     */
    public function getProductFileAction()
 
    /**
     * Action set sidebar text pattern.
     * @layerId string ObjectId
     * @pattern string sidebar text pattern
     * @return string 200 Ok
     */
    public function setSideBarAction()
 
    /**
     * Action get sidebar text pattern.
     * @layerId string ObjectId
     * @return string 200 Ok
     */
    public function getSideBarAction()
 
    /**
     * Action find user by name.
     * @name string userName regexp.
     * if name =='' return all users, else search by regexp
     * @return string 200 [userId,name]
     */
    public function findUsersByNamesAction()
 
    /**
     * Action find tree by name.
     * @name string treeName regexp.
     * @return string 200 [treeId,name]
     */
    public function searchTreeByNameAction()
 
    /**
     * GET
     * Action get translation array
     * @language language code en/ru
     * @return 200, json translation
     */
    public function getTranslateAction()
 
    /**
     * POST
     * Action create layers object
     * @layerId ObjectId layers id
     * @treeId ObjectId tree Id
     * @geometry string geo json geometry
     * @properties string json properties
     * @return 200 new objectId
     */
    public function createObjectAction()
 
    /**
     * POST
     * Action update layers object
     * @objectId ObjectId layer object id
     * @layerId ObjectId layer id
     * @treeId ObjectId tree Id
     * @objectId ObjectId layer object id
     * @geometry geojson geometry
     * @properties json properties
     * @return 200 Ok
     */
    public function updateObjectAction()
 
    /**
     * POST
     * Action remove layers object
     * @treeId ObjectId tree id
     * @layerId ObjectId layer id
     * @objectId ObjectId layer object id
     * @return 200 Ok
     */
    public function removeObjectAction()
 
    /**
     * POST
     * Action change the layer for a layer object
     * @layerId objectId layers id
     * @newLayerId objectId new layers id
     * @treeId ObjectId tree id
     * @objectId ObjectId layer object id
     * @return 200 Ok
     */
    public function changeLayerObjectAction()
 
    /**
     * Action activate users devices.
     * @request string *
     * @providerId string *
     * @receipt string for iOs devices.
     * @web int if from webbrowser
     * @os string devices OS
     * @purchaseId string purchaseToken or pincode
     * @return 200 Ok
     */
    public function activationAction()
 
    /**
     * POST
     * Action confirm paid products
     * @productId objectId product id
     * @purchaseName string purchases name
     * @return 200 Ok
     */
    public function productPayConfirmAction()
 
    /**
     * GET
     * Action get unconfirmed paid products
     * @return 200 Ok json
     */
    public function getUnconfirmedPaidProductAction()
 
    /**
     * GET
     * Action get help objects
     * @return 200 Ok json help objects
     */
    public function getHelpAction()
 
    /**
     * POST
     * Action add help object
     * @help json help object
     * @file file help media file
     * @return 200 Ok
     */
    public function addHelpAction()
 
    /**
     * POST
     * Action update the help object
     * @helpObjectId objectId help object id
     * @help json help object
     * @file file help media file
     * @return 200 Ok
     */
    public function updateHelpAction()
 
    /**
     * POST
     * Action remove help object
     * @helpObjectId objectId help object id
     * @return 200 Ok
     */
    public function removeHelpAction()

Tree

{
  _id: ObjectID;
  "properties": {
    "type": "tree",
    "name": string,
    "ownerId": ObjectID,
    "shared": "free"/"private",
  },
  "children": []/null;
}

Directory

{
  _id: ObjectID;
  "properties": {
    "type": "dir";
    "name": string;
  },
  "children": []/null;
}

Layer

{
  "properties": {
    "type": "layer",
    "api": string,
    "alias": ObjectID 
  },
  "children": []/null
}

Layer Entity

{
  _id: ObjectID;
  "properties": {
    "type": "layerEntity",
    "name": string,
    "index": [],
    "api": string/null
  },
  "children": []/null,
  "options": [standartLayerOptions]
}

Map

{
  _id: ObjectID;
  properties: {
    type: "map";
    typeMap: "osm"/"2gis"/"mapbox"/"yandex"/"google",
    name: string;
    url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
    urlCache: "http://cache.mrgis02.mrsks.local/osm/{z}/{x}/{y}.png",
    options: {
      maxZoom: 18
    },
    checked: 1,
    cache: 0,
  }
}

overlayLayer

{
	"properties": {
		"type": "overlayLayer",
		"name": "Зоны с особыми условиями использования территории",
		"url": "//pkk5.rosreestr.ru/arcgis/rest/services/Cadastre/ZONES/MapServer/export?",
		"options": {
			"format": "image/png",
			"transparent": "true",
			"tileSize": 256,
			"zIndex": 100,
			"shiftX": 0,
			"shiftY": 0,
			"maxZoom": 18
		},
		"checked": false
	}
}

Tokens

Response header
// Access open
Authorization: 0;
// Expired token
Authorization: 1;
// Access denied
Authorization: 2;
// Some error
Authorization: 3;
 
// Refresh Token
refresh_token : some_token;
// Access Token
access_token : some_token;

Users

{
  _id: ObjectID,
  name: string,
  email: string,
  password: bcrypt,
  time: time,
  groups: [
      groupId(ObjectID),
      groupId(ObjectID)
  ],
  products: [
    productId(ObjectID),
    productId(ObjectID)
  ]
}

Interaction mask (interaction_mask)

// 0 uses for invisible groups or products. Users can get access from owner invite only.
0 - invite
// Users can sent invite to owner groups or products.
1 - private
// Users can join to group without limitations.
2 - public
// Users can buy product.
3 - buy
// Users can get product, if they have premium account.
4 - premium

Mask of access for groups (group_mask)

// Mask of access to group/product. Can take 3 values 1 - read, 2 - write, 4- access.
// For groups
Read allows to see group members, write allows to add group members, access allows do delete and configure group. 
// For example
// User doesn't have access to group/product. 
0
//user has access to group/product.
4

Groups

{
  _id: ObjectID,
  name: string
  access: interaction_mask,
  users: [
    {
      userId: ObjectID,
      mask: group_mask
    }
  ],
  tree: [
    {
      treeId: ObjectID,
      mask: group_mask
    }
  ],
}

Products

{
  _id: ObjectID,
  owner: {
      userId/groupId : ObjectID
  },
  treeIds[]/file: ObjectID/filepath,
  type: string(tree/map),
  access: interaction_mask,
  title: string,
  description: text,
  shortDescription: text,
  shortDescription: text,
  icon: icon,
  cost: [
      string(ISO 3166-1 alpha-3) : double,
      ...
  ],
  users: [
      ObjectID
  ],
  purchaseId : string  
}

Translations

{
    "_id" : ObjectId,
    "language" : string,
    "code" : string,
    "phrases" : {
        "phrases" : "phrases translate",
        ...
    }
}

Orders

{
    "_id" : ObjectId,
    "userId" : ObjectId,
    "providerId" : ObjectId,
    "productId" : ObjectId/string,
    "softExpire" : int,
    "hardExpire" : int,
    "cost" : float,
    "date" : Date,
    "activation" : {
        "token" : string,
        "activated" : boolean,
        "activatedDate" : Date,
        "deviceId" : string,
        "serialNumber" : stirng,
        "expired" : boolean
    }
}

Helps

{
    title : string,
    order : int,
    text: string,
    url: string,
    type: string("Video"/"Image")
}

Users role

0 - map user пользователь портала созданого cms user-ом, может находится в группах созданных cms user-ом, создаётся при регистрации в портале cms user-а, добавлении cms user-ом, и при встраивании БД заказчика.

1 - cms user пользователь CMS имеет возможность генерировать порталы и создавать пользователей 0 уровня, создаётся при регистрации в AirLay

2 - brand user пользователь Администратор системы AirLay доступны конфигурации бренда системы и работы с базой системы, создаётся при инициализации системы на сервере

en/api/air-lay.txt · Последнее изменение: 2019/04/25 17:44 — Калинин Александр Игоревич