Zone Events
Overview
Use the Zone Events API to:
- Get a history of zone events
HTTP headers
The HTTP headers used to access all RTLS APIs are listed below. Before submitting requests to the Alarms API, set the following headers:
| Header Name | Example Value | Description |
|---|---|---|
| X-User-Email | admin@example.com | Email of the user performing HTTP requests to the API. |
| X-User-Token | Drv3yU7PdyqUMtr89erZ | Token allowing the user access to the API. |
| X-User-Project | OfOgUA4kTs2HrmYYlFw6Jg | Project identifier. Value of the project.uid field. |
Set header X-USER-EMAIL
Send a request to log in using POST api/auth/log_in described in the Auth API. Using the email address returned in the response, set:
X-USER-EMAIL = data.email
Set header X-USER-TOKEN
Send a request to log in using POST api/auth/log_in described in the Auth API. Using the authentication token returned in the response, set:
X-USER-TOKEN = data.token
Set header X-USER-PROJECT
Send a request to get projects using GET api/projects/ described in the Projects API. You must send this request with headers X-USER-EMAIL and X-USER-TOKEN already set. Using the project UID returned in the response, set:
X-USER-PROJECT = projects[i].uid
Zone events endpoints
| Functionality | Method | Endpoint |
|---|---|---|
| get zone events | GET | api/zone_events |
Endpoints
Get zone events
GET api/zone_events?from={timestamp in milliseconds}&to={timestamp in milliseconds}
GET api/zone_events?from={timestamp in milliseconds}&to={timestamp in milliseconds}&trackable_objects={uid}
GET api/zone_events?from={timestamp in milliseconds}&to={timestamp in milliseconds}&trackable_objects={uid}&trackable_objects={uid}
GET api/zone_events?from={timestamp in milliseconds}&to={timestamp in milliseconds}&sublocation_uid={uid}
GET api/zone_events?from={timestamp in milliseconds}&to={timestamp in milliseconds}&sublocation_uid={uid}&zone_type_name={zone_type_name}
Get all zone zone_events.
Request Fields
| Field | Required/Optional | Values | Type | Description |
|---|---|---|---|---|
| from | required | - | number | The time stamp that marks the beginning of the time frame. Timestamp is in milliseconds. |
| to | required | - | number | The time stamp that marks the end of the time frame. Timestamp is in milliseconds. |
| trackable_objects | optional | - | string | The list of unique identifiers of the trackable object. |
| sublocation_uid | optional | - | string | The unique identifier of the area. |
| zone_type_name | optional | - | string | The system name of the zone type. See Zones API document. |
Response Fields
| Field | Description |
|---|---|
| obj_uid | The unique identifier of the trackable that triggered the zone event. |
| sublocation_uid | The unique identifier for the area where the event occurred. |
| created_at | The timestamp when the zone event occurred, in UTC. |
| zone_uid | The unique identifier for the zone that generated the zone event. |
| zone_type_name | The type of the zone where the event occurred. See Zones API document. |
| type | Reserved for future use. |
| action | The description of the zone event state:
|
| project_uid | The unique identifier of the project. |
| company_uid | The unique identifier of the company. |
| x | The x coordinate of the position where the zone event occurred. |
| y | The y coordinate of the position where the zone event occurred. |
| z | The z coordinate of the position where the zone event occurred. |
| duration | The time, in milliseconds, that the trackable spent in the zone, calculated by the time elapsed between the trackable's entry and exit. Note: The duration only includes time during which the zone was active. |
Example Response
{
"zone_events" : [
{
"obj_uid": "eanhNkPJk6dvaCWS0pN2yZ",
"sublocation_uid": "2Gq85f4v4tm7KN7LuSXUud",
"created_at": "2018-07-26T03:38:03.734Z",
"zone_uid": "C5jONabGcccMdAivfD84LR",
"zone_type_name": "keep_out",
"type": "zone_event",
"action": "leave",
"project_uid": "3SpvwAdp8XQ9e5CvMzTxqb",
"company_uid": null,
"x": -7840,
"y": 3008,
"z": 1008,
"duration": 706607
}
]
}
Errors
| Error Status | Error Type | Error Body | Error Description |
|---|---|---|---|
| 422 | Unprocessable Entity | {"message":"...", "status":422} | Validation error. |