POSITIONS HISTORY
Use the position history API to get the position history of specified trackables in a specified time frame.
HTTP Headers
The HTTP headers used to access all RTLS APIs are listed below. Before submitting requests to the Positions History 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 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.json 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.json 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
Positions History Endpoints
| Functionality | Method | Endpoint |
|---|---|---|
| get positions history endpoint | GET | api/positions_history |
Endpoints
Get positions history
GET api/positions_history?sublocation_uid={uid}&from={unix_timestamp}&to={unix_timestamp}&trackable_objects[]={uid}&trackable_objects[]={uid}&page=0
Get position history data in a zip file. The zip file contains a .csv file.
Notes:
- Position data generated within the latest 15 minutes will be retrieved with a delay up to 1 minute.
- When you retrieve position data, and the
fromparameter timestamp is more than 15 minutes earlier than the current timestamp, the response might not contain the position data generated for the last 5 minutes. For example, assuming the current timestamp is 00:00:00 UTC: - If the requested period is from 23:55:00 to 00:00:00 UTC, the response contains all the data.
- If the requested period is from 23:45:00 to 00:00:00 UTC, the response contains all the data.
If the requested period is from 23:40:00 to 00:00:00 UTC, the response might not contain the positions data from 23:55:00 to 00:00:00 UTC.
For requests where the
fromparameter is 15 minutes earlier than the current time, the maximum number of positions in one response is limited to 10000 records.The value of the HTTP response header 'content-next-positions-page' will point to the next page. For example,
content-next-positions-page: 1in the response header means that the next page is 1. To request the next page, the page number should be specified as part of URL:/api/positions_history&page=1.
When the total count of requested positions is less than 10000 the HTTP response header 'content-next-positions-page' will contain the value 0.
- The maximum number of concurrent requests allowed from a single user is 5. The total number of concurrent requests allowed is 30.
Request Fields
| Field | Required/Optional | Type | Description |
|---|---|---|---|
| sublocation_uid | required | string | The unique identifier of the area from which you want to pull information. To retrieve an area UID, use GET api/sublocations described in Sublocations API. |
| trackable_objects | optional | string | The unique identifiers of the trackables. When no trackable UID is specified, the response returns the position history of all trackables in the area. |
| from | required | number | The time stamp of the beginning of the time frame on which to be reported, in milliseconds. |
| to | required | number | The time stamp of the end of the time frame on which to be reported, in milliseconds. |
Response Fields
When submitting the request, specify that the response should be downloaded. The response returns a zip file with a .csv format file.
The table in the .csv file contains the following columns:
| Column | Description |
|---|---|
| id | The identifier of the position report in the server. |
| ts | The time stamp of the position report in seconds. |
| ms | The milliseconds part of the time stamp. |
| mac_address | The MAC address of the node. |
| x | The x coordinate of the position. |
| y | The y coordinate of the position. |
| z | The z coordinate of the position. |
| obj_uid | The unique identifier of the trackable. |
| sublocation_uid | The unique identifier of the area. |
| project_uid | The unique identifier of the project. |
| type | The type of position report:
|
Errors
| Error Status | Error Type | Error Body | Error Description |
|---|---|---|---|
| 422 | Unprocessable Entity | {"message":"Incorrect query","name":"UnprocessableEntityError"} | Required field missing or has invalid format. |
| 422 | Unprocessable Entity | {"code":"VALIDATION_ERROR","message": error message} |
Required field missing or has invalid format. |