Zones

Zones displays a tree of floor plans that have floors as child elements, and floors, in turn, have zones as child elements.

URI Definition

Method

URI and Fields

GET










/iap/zones

Retrieves all zones that the current user is permitted to read.  This method allows pagination.

Query Parameters

pg                    (Optional)  Page number. Skipped if null or negative.                                                                 
sz(Optional)  Size of a page. Skipped if null or negative.
name(Optional)  Return only zones that have the specified string in their names.
sortBy(Optional)  Sort returned collection by the specified field.
sortOrder(Optional)  Sort order. Can be either ASC (ascending) or DESC (descending).

Return Code

200                  Success.                                                                                                                                         

Example

https://localhost/iap/zones


Response:

[
    {
        "id": 490,
        "name": "Zone",
        "description": "description",
        "polygon": {
            "type": "Polygon",
            "coordinates": [
                [
                    [-2, -2], [-2, 2], [2, 2], [2, -2], [-2, -2]
                ]
            ]
        },
        "floorId": 489,
        "color": "red"
    }
]                                                                                                                                       

/iap/zones/{zone}

Retrieves all zones that the current user is permitted to read. 

Path Parameters

For a description of the valid path parameters, see Zone Path Parameters at the bottom of this page.

Query Parameters

pg                    (Optional)  Page number. Skipped if null or negative.                                                                 
sz(Optional)  Size of a page. Skipped if null or negative.

Return Code

200                  Success.                                                                                                                                      

Example

https://localhost/iap/zones/*

https://localhost/iap/zones/*+name=+^fp1

Response:

[
    {
        "id": 73,
        "name": "fp1-f1-z1",
        "polygon": {
            "type": "Polygon",
            "coordinates": [
                [
                    [
                        271.0,
                        265.0
                    ],
                    [
                        271.0,
                        319.0
                    ],
                    [
                        402.0,
                        319.0
                    ],
                    [
                        402.0,
                        265.0
                    ],
                    [
                        271.0,
                        265.0
                    ]
                ]
            ]
        },
        "floorId":  72,
        "color":   "red"
    }
]                                                                                                                                       

/iap/zones/count

 Retrieves the number of zones.

Query Parameters

rootsOnly        (Optional)  If true then only root zones are counted.                                                                  
Default = false
name(Optional)  Count only zones that have the specified string in their name.

Return Code

200                  Success.                                                                                                                                         
/iap/zones/{id}

Retrieves a zone by ID.

  • id - zone ID

Path Parameter

id                    (Required)  Zone ID.                                                                                                                        

Return Codes

200                  Success.                                                                                                                                         
400Zone does not exist.
/iap/zones/{id}/children

Retrieves a collection of child zones for the specified zone.

Path Parameter

id                    (Required)  ID of parent zone.                                                                                                        

Query Parameters

recursive        

(Optional)  If true, allows recursive requests for children.                                                           
Default = false.

pg(Optional)  Page number. Skipped if null or negative.
sz(Optional)  Size of a page. Skipped if null or negative.

Return Codes

200                 Success.                                                                                                                                         
400Zone does not exist.
/iap/zones/roots

Retrieves a collection of root zones.

Query Parameters

floorid             (Optional)  ID of a floor that has zones.
pg                    (Optional)  Page number. Skipped if null or negative.                                                                 
sz(Optional)  Size of a page. Skipped if null or negative.

Return Code

200                  Success.                                                                                                                                         

PUT




 /iap/zones/delete

 Deletes zones by list of IDs.

Query Parameter

cascade             (Required) Flag indicates that all children zones must be removed as well.                          
Default = false 

Body

Contains the list of IDs. 

Body Example

[1,2,3]                                                                                                                                                                            

Return Codes

204         Success.  Zone deleted.                                                                                                                         
422

Zone has assigned child zones.

      

/iap/zones/{id}

Updates an existed zone by ID with the specified properties.

Path Parameter

id                        (Required) zone ID                                                                                                                      

Parameters

name                  (Required)                                                                                                                                    
description   (Optional) 
polygon(Required)  
color(Optional) 

Example

{                                                                                                                                                                                     
"name":"ZoneChild",
"description":"description",
"polygon":{"type":"Polygon","coordinates":[[[-0.5,-0.5],[-0.5,0.5],[0.5,0.5],[0.5,-0.5],[-0.5,-0.5]]]} ,
"color":"red"
}

Return Codes

200         Success.  Zone created.                                                                                                                         
422

One of the following applies:

  • Zone must have a name.
  • Zone with name already exists.
  • Zone intersects another zone.
  • Zone is included in another zone.
  • Zone is not included in parent.
POST



/iap/zones/child

Creates a child zone with the specified properties.

Query Parameter

zoneid                (Required) ID of parent zone                                                                                                      

Parameters

name                  (Required)                                                                                                                                    
description   (Optional) 
polygon(Required)  
color(Optional) 

Example

{                                                                                                                                                                                     
"name":"ZoneChild",
"description":"description",
"polygon":{"type":"Polygon","coordinates":[[[-0.5,-0.5],[-0.5,0.5],[0.5,0.5],[0.5,-0.5],[-0.5,-0.5]]]} ,
"color":"red"
}

Return Codes

200         Success.  Zone created.                                                                                                                         
400

One of the following applies:

  • Parent zone ID not specified.
  • Parent zone does not exist.
422

One of the following applies:

  • Zone must have a name.
  • Zone with name already exists.
  • Zone intersects another zone.
  • Zone is included in another zone.
  • Zone is not included in parent.

/iap/zones/root

Creates a root zone with the specified properties.

Parameters

name                  (Required)                                                                                                                                    
description(Optional) 
polygon(Required) 
floorId(Required) 
color(Optional) 

Example

{                                                                                                                                                                                     
"name":"Zone",
 "description":"description",
 "polygon":{"type":"Polygon","coordinates":[[[-0.5,-0.5],[-0.5,0.5],[0.5,0.5],[0.5,-0.5],[-0.5,-0.5]]]},
 "floorId":1,
 "color":"red"
}

Return Codes

200         Success.  Zone created.                                                                                                                         
400

One of the following applies:

  • Parent zone ID not specified.
  • Parent zone does not exist.
422

One of the following applies:

  • Zone must have a name.
  • Zone with name already exists.
  • Zone intersects another zone.
  • Zone is included in another zone.
  • Zone is not included in parent.

Query and Path Parameters

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

Zone Path Parameters

The following list describes the optional path parameters for the zones endpoints. 

Path Parameter              Description

device.name

Filters for zones that contain devices with the specified name

floor.id

Filters for zones located on a floor with the specified ID

floor.name

Filters for zones located on a floor with the specified name

floorplan.id

Filters for zones located in a floorplan with the specified ID

floorplan.name

Filters for zones located in a floorplan with the specified name

geozone.id

Filters for zones located in a geozone with the specified ID

geozone.name

Filters for zones located in a geozone with the specified name

groups.id

Filters for zones that contain devices that belong to a group with the specified ID

groups.name

Filters for zones that contain devices that belong to a group with the specified name

id

Filters for zones with the specified zone ID

name

Filters for zones with the specified name

scId

Filters for zones that contain devices connected to an Edge Server with the specified ID

scNameFilters for zones that contain devices connected to an Edge Server with the specified name