Geozone

URI Definition

Method

URI and Fields

GET

/iap/gz

Returns all geozones that the current user has permission to read.

Query Parameters

  • pg - page number. Skipped if null or negative
  • sz - size of a page. Skipped if null or negative
  • name - filter geozones by the specified substring in their names
  • scId – filters geozones by segment controller’s id
  • scName – fileters geozones by segment controller’s name
  • sortBy - sorting returned collection by the specified field
  • sortOrder - sorting order. Can be either ASC or DEC

Success Response

Collection of geozones.

Example

https://localhost/iap/gz

Response

[
   {
       "id": 88,
       "name": "World",
       "description": "",
       "polygon": {
           "type": "Polygon",
           "coordinates": [
               [
                   [
                       -180,
                       -90
                   ],
                   [
                       -180,
                     90
                   ],
                   [
                       180,
                       90
                   ],
                   [
                       180,
                       -90
                   ],
                    [
                       -180,
                       -90
                   ]
               ]
           ]
       },
       "customerId": 81
   }
]                                                                                                                                          

/iap/gz/{id}/children

Returns collection of child geozones for the specified geozone. 

Parameter

  • id – ID of the root geozone

Query Parameters

  • pg – page number. Skipped if null or negative
  • sz – size of a page. Skipped if null or negative
  • recursive – returns recursively children for every child geozone if set to true, by default false

Success Response

Collection of geozones.

Example

https://localhost/iap/gz/88/children

Response

[
   {
       "id": 1385,
       "name": "Test Child Geozone",
       "description": "Test Child Geozone",
       "polygon": {
           "type": "Polygon",
           "coordinates": [
               [
                   [
                       -113.038330078125,
                       37.87485339352928
                   ],
                   [
                        -113.038330078125,
                       41.49212083968776
                   ],
                   [
                       -104.820556640625,
                       41.49212083968776
                   ],
                   [
                       -104.820556640625,
                       37.87485339352928
                   ],
                   [
                       -113.038330078125,
                       37.87485339352928
                   ]
               ]
           ]
       },
       "customerId": 81
   }
]                                                                                                                                          

/iap/gz/roots

Returns all root geozones that the current user is permitted to read. The root geozone is a geozone that does not have a parent geozone.

Query Parameters

  • pg - page number. Skipped if null or negative
  • sz - size of a page. Skipped if null or negative

Success Response

Collection of geozones.

Example

https://localhost/iap/gz/roots

Response

[
   {
       "id": 88,
       "name": "World",
       "description": "",
       "polygon": {
           "type": "Polygon",
           "coordinates": [
               [
                   [
                       -180,
                       -90
                   ],
                   [
                       -180,
                       90
                   ],
                   [
                       180,
                       90
                   ],
                   [
                        180,
                       -90
                   ],
                   [
                       -180,
                       -90
                   ]
               ]
           ]
       },
       "customerId": 81
   }
]                                                                                                                                           

/iap/gz/{id}

Returns the geozone with the specified ID. Returns nothing if the current user doesn’t have permission to read this geozone.

Parameter

  • id - the ID of geozone

Success Response

Geozone with the specified ID.

Example

https://localhost/iap/gz/88

Response

{
   "id": 88,
   "name": "World",
   "description": "",
   "polygon": {
       "type": "Polygon",
       "coordinates": [
           [
               [
                   -180,
                  -90
               ],
               [
                   -180,
                   90
               ],
               [
                   180,
                   90
               ],
               [
                   180,
                    -90
               ],
               [
                   -180,
                   -90
               ]
           ]
       ]
   },
   "customerId": 81
}

                                                                                                                                           

/iap/gz/count

Returns count of the geozones that current user is permitted to read. If the rootsOnly parameter is set to true, then only root geozones will be taken into account.

Query Parameters

  • rootsOnly - if true, only root geozones will be counted.
  • name - count geozones only with the specified substring in their names. 
  • scId - count geozones segment controller with the specififed ID.
  • scName - count geozones segment controller with the specififed name.

Success Response

Number of geozones.

Example

https://localhost/iap/gz/count?rootsOnly=true

Response

{
   "value": 1
}                                                                                                                                          

PUT

/iap/gz

Updates an existing geozone with the specified properties.

Query Parameter

  • gzDTO - properties used to update the geozone

Success Response

Successfully updated geozone.

Example

https://localhost/iap/gz

Request Payload

{
"id":88,
"name":"World",
"description":"UPDATED",
"polygon":{
   "type":"Polygon",
   "coordinates":[
     [
       [-180,-90],
       [-180,90],
       [180,90],
       [180,-90],
       [-180,-90]
     ]
   ]
},
"customerId":81
}


Response

{
   "id": 88,
   "name": "World",
   "description": "UPDATED",
   "polygon": {
       "type": "Polygon",
       "coordinates": [
           [
               [
                   -180,
                   -90
               ],
               [
                   -180,
                   90
               ],
               [
                   180,
                   90
               ],
               [
                   180,
                   -90
               ],
               [
                   -180,
                   -90
               ]
           ]
       ]
   },
   "customerId": 81
}                                                                                                                                          

POST

/iap/gz/root

Creates a root geozone with the specified properties

Query Parameter

  • gzDTO - properties used to create a new geozone

Success Response

Returns the successfully created geozone.

Example

https://localhost/iap/gz/root

Request Payload

{
"polygon":{
   "type":"Polygon",
   "coordinates":[
     [
     [-113.038330078125,37.87485339352928],
       [-113.038330078125,41.49212083968776],
       [-104.820556640625,41.49212083968776],
       [-104.820556640625,37.87485339352928],
       [-113.038330078125,37.87485339352928]
     ]
   ]
},
"name":"Root Child Geozone",
"description":"Root Child Geozone",
"customerId":81
}


Response
 {
   "id": 1389,
   "name": "Root Child Geozone",
   "description": "Root Child Geozone",
   "polygon": {
       "type": "Polygon",
       "coordinates": [
           [
               [
                   -113.038330078125,
                   37.87485339352928
               ],
               [
                   -113.038330078125,
                   41.49212083968776
               ],
                [
                   -104.820556640625,
                   41.49212083968776
               ],
               [
                   -104.820556640625,
                   37.87485339352928
               ],
               [
                   -113.038330078125,
                   37.87485339352928
               ]
           ]
       ]
   },
   "customerId": 81
}                                                                                                                                         

/iap/gz/child

Creates a child geozone for the specified geozone. Throws a validation exception if the geozone cannot be created. The user must have WRITE permission for the specified geozone.

Query Parameters

  • geozoneId – the ID of geozone for which child geozone will be created
  • gzDTO – parameters from which child geozone will be created

Success Response

Successfully created child geozone.

Example

https://localhost/iap/gz/child?geozoneId=88


Request Payload

{
"polygon":{
   "type":"Polygon",
   "coordinates":[
     [
       [-113.038330078125,37.87485339352928],
       [-113.038330078125,41.49212083968776],
       [-104.820556640625,41.49212083968776],
       [-104.820556640625,37.87485339352928],
       [-113.038330078125,37.87485339352928]
     ]
   ]
},
"name":"Test Child Geozone",
"description":"Test Child Geozone"
}


Response

{
   "id": 1388,
   "name": "Test Child Geozone",
   "description": "Test Child Geozone",
   "polygon": {
       "type": "Polygon",      
       "coordinates": [
           [
               [
                   -113.038330078125,
                   37.87485339352928
               ],
               [
                   -113.038330078125,
                   41.49212083968776
               ],
               [
                   -104.820556640625,
                   41.49212083968776
               ],
               [
                   -104.820556640625,
                   37.87485339352928
               ],
               [
                  -113.038330078125,
                   37.87485339352928
               ]
           ]
       ]
   },
   "customerId": 81,
   "parentId": 88
}                                                                                                                                         

DELETE

/iap/gz/{id}

Removes the specified geozone from the CMS. The user must have WRITE permission on this geozone to perform this operation. If cascade is set to true then all child geozones will be removed as well.

Parameter

  • id - the ID of the geozone to be removed

Query Parameter

  • cascade - flag indicates that all child geozones must be removed as well

Success Response

empty

Example

https://localhost/iap/gz/1388

Response

empty                                                                                                                                           

Query Parameters

Optional query parameters can be used with your REST request.  Specifying queries is described under Queries and ParametersPath Parameters, and Query Parameters.