locationmwm

Location

The user can logically divide the location based on the area of AP used. Every AP can be tagged to a location. There are calls like Get Location which fetches the location hierarchy like Root-US-India-Pune and so on. There are various calls which provide details like location id, location name, timezone and such factors.

JSON Table

Attribute Data Type Description
 type  String The location type. The applicable values are:

  • folderlocation
  • floorlocation
 id  application/json
 id/type  String Its the type of location ID. The applicable values are:

  • locallocationid
  • remotelocationid

The remotelocationid ID type is applicable only in cluster environments.

 id/id  int System-generated unique ID of the location.
 id/childId  int It is an unique identifier for child servers in server cluster environment.
Applicable only when location id type is remotelocationid.
 name  String Name of the location.
 accessibleToUser  boolean A  true or false value indicating whether the user has rights to access this location.
 defaultLocation  boolean A true or false value indicating whether the location is an ‘unknown’ location.
 timezoneId  String The JAVA timezone ID of the location.
 locationTag  String A user-defined tag for the location.
 children  application/json A list of IDs of the child locations. The ID is a JSON object.
 children/type Its the type of  Child location ID. The applicable values are:

  • locallocationid
  • remotelocationid

The remotelocationid ID type is applicable only in cluster environments.

 children/id System-generated unique ID of the Child location.
 children/name Name of the Child location.
 children/accessibleToUser A  true or false value indicating whether the user has rights to access this Child location
 children/defaultLocation  A true or false value indicating whether the Child location is an ‘unknown’ location.
 children/timezoneId The JAVA timezone ID of the Child location.
 children/locationTag A user-defined tag for the Child location.
 children/children A list of IDs of the child locations. The ID is a JSON object.

Copy Sample JSON
Sample JSON

{
    "type": "folderlocation",
    "id": {
        "type": "locallocationid",
        "id": 0
    },
    "name": "Locations",
    "accessibleToUser": true,
    "defaultLocation": false,
    "timezoneId": "Asia/Calcutta",
    "locationTag": null,
    "children": [
        {
            "type": "folderlocation",
            "id": {
                "type": "locallocationid",
                "id": -1
            },
            "name": "Unknown",
            "accessibleToUser": true,
            "defaultLocation": true,
            "timezoneId": "Asia/Calcutta",
            "locationTag": null,
            "children": []
        },
        . . .
        . . .
	. . .

        {
            "type": "folderlocation",
            "id": {
                "type": "locallocationid",
                "id": 3
            },
            "name": "Test1",
            "accessibleToUser": true,
            "defaultLocation": false,
            "timezoneId": "Asia/Calcutta",
            "locationTag": null,
            "children": [
                {
                    "type": "folderlocation",
                    "id": {
                        "type": "locallocationid",
                        "id": 4
                    },
                    "name": "Child1",
                    "accessibleToUser": true,
                    "defaultLocation": false,
                    "timezoneId": "Asia/Calcutta",
                    "locationTag": null,
                    "children": []
                }
            ]
        }
    ]
}
API Calls

/V5/locations

/V5/locations

/V5/locations

/V5/locations/move

/V5/locations/tree/subtree

/V5/locations

Get Locations

Description This API is used to fetch the location tree for a logged-in user.
Users with the following roles can call this API: superuser, administrator, and operator.
Syntax
GET  <Base_URL>/locations
Sample code
GET https://training.mojonetworks.com/new/webservice/v5/locations
Request Body  This API call does not require any request body parameters.
Response Body  If the API call is successful, the HTTP response status is 200.
The response body contains the details of the location tree for the logged-in user in the application/json format.

Add Location

Description  This API is used to add a location in the location tree.
Users with the following roles can call this API: superuser, administrator, and operator.
Syntax
PUT <Base_URL>/locations
Sample code
PUT https://training.mojonetworks.com/new/webservice/v5/locations
Request Body This API call requires the details of the Location to be created in the location, which is passed as parameters in the request body. The parameters are passed in the application/json format.

A sample request body is as follows:

{
    "type": "folderlocation",
    "id": {
        "type": "locallocationid",
        "id": 0
    },
    "name": "Locations",
    "accessibleToUser": true,
    "defaultLocation": false,
    "timezoneId": "Asia/Kolkata",
    "locationTag": null,
    "children": [{
            "type": "folderlocation",
            "id": {
                "type": "locallocationid",
                "id": 6
            },
            "name": "ChildLoc6",
            "accessibleToUser": true,
            "defaultLocation": true,
            "timezoneId": "Asia/Kolkata",
            "locationTag": null,
            "children": []
    }]
}
Response Body If the API call is successful, the HTTP response status is 200.
The response body contains the details of the location tree for the logged-in user. The response is in the application/json format.

Add Locations and Sub-Locations

Description  This API is used to add locations and sub locations to the location tree.
Users with the roles can call this API: superuser, administrator, and operator.
Syntax
POST <Base_URL>/locations/tree/subtree?locationid=<value>&nodeid=<value>

Here,

  • locationid

    The ID of the location under which the locations and sub-locations must be created. It takes an integer value.

  • nodeid

    The node ID in the case of a cluster deployment. It takes an integer value.

Sample code
POST https://training.mojonetworks.com/new/webservice/v5/locations/tree/subtree?locationid=0&nodeid=1
Request Body This API call requires information of the Loactions to be added, which are passed as parameters in the request body. The parameters are in the application/json format.

A sample request body is as follows:

[{
   "location": 
   {
      "type": "folderlocation",
      "name": "MyLocation100",
      "timezoneId": "Asia/Calcutta"
   },
   "locationSubTrees": 
   [{
      "location": 
      {
         "type": "folderlocation",
         "name": "MyLocation110",
         "timezoneId": "Asia/Calcutta"
      },
      "locationSubTrees": 
      [{
         "location": 
         {
            "type": "folderlocation",
            "name": "MyLocation111",
            "timezoneId": "Asia/Calcutta"
         }, 
         "location": 
         {
            "type": "folderlocation",
            "name": "MyLocation112",
            "timezoneId": "Asia/Calcutta"
         }
      }]
   }, 
   {
      "location": 
      {
         "type": "folderlocation",
         "name": "MyLocation120",
         "timezoneId": "Asia/Calcutta"
      }
   }]
}]
Response Body If the API call is successful, the HTTP response status is 200.
The response body does not contain any information.

Update Location

Description  This API can be used to modify the name and timezone for a location.
Users with the following roles can call this API: superuser, administrator, and operator.
Syntax
POST <Base_URL>/locations
Sample code
POST https://training.mojonetworks.com/new/webservice/v5/locations
Request Body This API call requires the details of the Location to be updated, which is passed as parameters in the request body. The parameters are passed in the application/json format.
A sample request body is as follows:

{
    "locationId":
        {
            "type": "locallocationid",
            "id": 3870
        },
   "name": "Location-Rebranded",
   "timezoneId": "Asia/Calcutta",
   "applyRecursive": false
}
Response Body If the API call is successful, the HTTP response status is 200.
The response body contains the details of the location updated in the application/json format.

Move Location

Description This API is used to move a location in the location tree.
Users with the following roles can call this API: superuser, administrator, and operator.
Syntax
POST <Base_URL>/locations/move
Sample code
POST https://training.mojonetworks.com/new/webservice/V5/locations/move
Request Body  This API call requires the details of the Location to be moved and its destination in the location tree, which is passed as parameters in the request body. The parameters are passed in the application/json format.

A sample request body is as follows:

{
	"destination":{
    	"type": "locallocationid",
     	"id":"16"
	},
	"locationId":{
    	"type": "locallocationid",
    	"id":"13"
    } 
}
Response Body If the API call is successful, the HTTP response status is 204.
The response body does not contain any information.

Delete Location

Description This API is used to delete a location and its child locations, if any, from the location tree.
Users with the roles: superuser, administrator, and operator.
Syntax
DELETE <Base_URL>/locations
Sample code
DELETE https://training.mojonetworks.com/new/webservice/v5/locations
Request Body This API call requires the details of the location to be deleted, which is passed as parameters in the request body. The parameters are passed in the application/json format. Depending on the location type, use the locallocationId or the remotelocationId schema. All the attributes in this JSON are mandatory. You must provide the appropriate values for all the JSON attributes.
Response Body If the API call is successful, the HTTP response status is 204.
The response body does not contain any information.