Zone
note
This resource shows how to interact with zone configurations in SENSR. You can add, delete or modify zones via this interface.
GET
/[SENSR version]/settings/zone/list
Get the list of available config-id and config data type of a zone.
- Parameters
- N/A
- Return code
- 200 OK
Example
$ curl -X GET 'http://localhost:9080/[SENSR version]/settings/zone/list'
** Respond **
[
{
"id": "Int",
"name": "String",
"zone_type": "String",
"speed_limit": "Float",
"loitering_threshold": "Int",
"min_z": "Float",
"max_z": "Float",
"vertices": "Array[Vector2]"
}
]
/[SENSR version]/settings/zone
Get an actual config of the desired zone
- Parameters
- zone-id : ID of zone. If you do not pass any
zone-id
this command returns the full list of zone IDs in the project.
- zone-id : ID of zone. If you do not pass any
- Return code
- 200 OK
- 400 BAD REQ
Example
curl -X GET 'http://localhost:9080/[SENSR version]/settings/zone'
** Respond **
[
1001,
1002
]
$ curl -X GET 'http://localhost:9080/[SENSR version]/settings/zone?zone-id=1001'
** Respond **
{
"id": 1001,
"name": "zone-1001",
"zone_type": "Event",
"speed_limit": 27.77,
"loitering_threshold": 0,
"min_z": 0.0,
"max_z": 2.5,
"vertices": [
[
8.95,
-21.91
],
[
-13.30,
-25.27
],
[
-12.95,
-4.06
],
[
16.37,
5.74
],
[
9.58,
-21.35
]
]
}
PUT
/[SENSR version]/settings/zone
Creates a new zone and adds it to the project. If this command was successful, the ID of newly added zone is returned.
The
id
-field in the body will be ignored, SENSR will assign a new ID to the newly created zone.You should also call /commands/apply-change to apply your changes.
- Parameters
- N/A
- Return code
- 200 OK
- 400 BAD REQ
Example
$ curl -X PUT 'http://localhost:9080/[SENSR version]/settings/zone'
--data '{
"id": 1001,
"name": "zone-1001",
"zone_type": "Event",
"speed_limit": 27.77,
"loitering_threshold": 0,
"min_z": 0.0,
"max_z": 2.5,
"vertices": [
[
-4.04,
5.27
],
[
-3.68,
3.32
],
[
-5.65,
3.02
],
[
-5.96,
4.85
]
]
}'
** Respond **
"1001
POST
/[SENSR version]/settings/zone
Update the configuration of an existing zone. The
id
-field should correspond to the ID of the zone to be updated.You should also call /commands/apply-change to apply your changes.
- Parameters
- N/A
- Return code
- 200 OK
- 400 BAD REQ
Example
$ curl -X POST 'http://localhost:9080/[SENSR version]/settings/zone'
--data '{
"id": 1001,
"name": "zone-1001",
"zone_type": "Event",
"speed_limit": 27.77,
"loitering_threshold": 0,
"min_z": 0.0,
"max_z": 2.5,
"vertices": [
[
-4.04,
5.27
],
[
-3.68,
3.32
],
[
-5.65,
3.02
],
[
-5.96,
4.85
]
]
}'
** Respond **
200 OK
DELETE
/[SENSR version]/settings/zone
Delete a specific zone.
You should also call /commands/apply-change to apply your changes.
- Parameters
- zone-id : ID of zone to be deleted.
- Return code
- 200 OK
- 400 BAD REQ
Example
$ curl -X DELETE 'http://localhost:9080/[SENSR version]/settings/zone?zone-id=1001'
** Respond **
200 OK
/[SENSR version]/settings/zone-all
Delete all zones in the project.
You should also call /commands/apply-change to apply your changes.
- Parameters
- N/A
- Return code
- 200 OK
- 400 BAD REQ
Example
$ curl -X DELETE 'http://localhost:9080/[SENSR version]/settings/zone-all'
** Respond **
200 OK