EVENT HISTORY

Use the Event History API to get the external event history of a specified trackable and event type in a specified time frame.

Limitations

The number of concurrent requests for one user is 5.

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 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.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

Event History Endpoints

Functionality Method Endpoint
get external events GET /api/external_events?from={ISO_8601_timestamp}&to={ISO_8601_timestamp}&event_type[]=pws&track_uid[]={uid}&format={json,csv}&archive={boolean}&limit={number}&page={number}

Endpoints

Get Event History

GET /api/external_events?from={ISO_8601_timestamp}&to={ISO_8601_timestamp}&event_type[]=pws&track_uid[]={uid}&format={json,csv}&archive={boolean}&limit={number} Get external events filtered from duplicates and based on the requested fields options.

Request Fields

Field Required/Optional Type Description
from optional string The time stamp that marks the beginning of the time frame of the event. Timestamp is in ISO 8601 format.
to optional string The time stamp that marks the end of the time frame of the event. Timestamp is in ISO 8601 format.
uploadedFrom optional string The time stamp that marks the beginning of the time frame of the event uploading from the tag to the server. Timestamp is in ISO 8601 format.
uploadedTo optional string The time stamp that marks the end of the time frame of the event uploading from the tag to the server. Timestamp is in ISO 8601 format.
event_type[] required string The list of external event types that you can retrieve from the database. Currently supported types:
  • pws
track_uid[] required string The list of the unique identifiers of the objects that generated the events.
format optional string The data format type. Currently supported types:
  • csv
  • json
The default format is json.
limit optional number The maximum limit of external events number in one response.
archive optional number The flag that indicates data compression:
  • true - data compressed
  • false - data not compressed
By default the flag is set to false. The value true disables the format option. The data will be in a zipped .csv, and the limit option is disabled.

Note: uploadedFrom and uploadedTo fields could not be used with the from, to fields. One of the field pairs (from, to) or (uploadedFrom, uploadedTo) required.

In case of json format data requested.

Response Fields

Field Description
totalCount A total count of events recorded in the database for the requested trackable with the filters applied (from-to, trackable_uid, event type).
nextPage The link to retrieve the next page of external events. Used in instances where the options determine the limit, and the total count of events is greater than specified limit.
external_events The list of external events.
external_events.object_uid The unique identifiers of the trackable.
external_events.object_name The name of the trackable.
external_events.mac_address The MAC address of the node associated to the trackable.
external_events.event_info The external event information.
external_events.event_type The event type.
external_events.ts The timestamp of event generation.
external_events.area_uid The unique identifier of the event generation area.
external_events.project_uid The unique identifier of the event generation project.
external_events.x The x coordinate of event generation, in millimeters.
external_events.y The y coordinate of event generation, in millimeters.
external_events.z The z coordinate of event generation, in millimeters.

Example Request

GET /api/external_events?event_type[]=pws&from=2020-05-31T21:00:00.000Z&to=2020-06-18T20:59:59.999Z&track_uid[]=-SVSorvKTeiY8PPcIbjPyA&limit=5

Example Response

{
    "totalCount": 93,
    "nextPage": "/api/external_events?event_type[]=pws&from=2020-05-31T21:00:00.000Z&to=2020-06-18T20:59:59.999Z&track_uid[]=-SVSorvKTeiY8PPcIbjPyA&limit=5&page=1",
    "external_events": [{
        "object_uid": "-SVSorvKTeiY8PPcIbjPyA",
        "mac_address": "c001a0006004",
        "event_info": "{\"contact_uid\":\"eUkfBCoXSdahkAfvI9WPxQ\",\"contact_name\":\"John Doe\", \"contact_mac\":\"e4956ea50a1f\",\"minimal_distance\":1000,\"severity_level\":2,\"duration\":1600}",
        "event_type": "pws",
        "ts": "2020-06-06T12:00:00.000Z",
        "area_uid": null,
        "project_uid": "VMKRetiPRDKm0zUHDQ5x6g",
        "x": null,
        "y": null,
        "z": null,
        "object_name": "TO-196"
    }, {
        "object_uid": "-SVSorvKTeiY8PPcIbjPyA",
        "mac_address": "c001a0006004",
        "event_info": "{\"contact_uid\":\"eUkfBCoXSdahkAfvI9WPxQ\",\"contact_name\":\"John Doe\", \"contact_mac\":\"e4956ea50a1f\",\"minimal_distance\":1000,\"severity_level\":2,\"duration\":136}",
        "event_type": "pws",
        "ts": "2020-06-06T12:00:01.000Z",
        "area_uid": null,
        "project_uid": "VMKRetiPRDKm0zUHDQ5x6g",
        "x": null,
        "y": null,
        "z": null,
        "object_name": "TO-196"
    }, {
        "object_uid": "-SVSorvKTeiY8PPcIbjPyA",
        "mac_address": "c001a0006004",
        "event_info": "{\"contact_uid\":\"eUkfBCoXSdahkAfvI9WPxQ\",\"contact_name\":\"John Doe\", \"contact_mac\":\"e4956ea50a1f\",\"minimal_distance\":1000,\"severity_level\":2,\"duration\":16}",
        "event_type": "pws",
        "ts": "2020-06-06T12:00:02.000Z",
        "area_uid": null,
        "project_uid": "VMKRetiPRDKm0zUHDQ5x6g",
        "x": null,
        "y": null,
        "z": null,
        "object_name": "TO-196"
    }, {
        "object_uid": "-SVSorvKTeiY8PPcIbjPyA",
        "mac_address": "c001a0006004",
        "event_info": "{\"contact_uid\":\"eUkfBCoXSdahkAfvI9WPxQ\",\"contact_name\":\"John Doe\", \"contact_mac\":\"e4956ea50a1f\",\"minimal_distance\":1000,\"severity_level\":2,\"duration\":1611}",
        "event_type": "pws",
        "ts": "2020-06-06T12:00:03.000Z",
        "area_uid": null,
        "project_uid": "VMKRetiPRDKm0zUHDQ5x6g",
        "x": null,
        "y": null,
        "z": null,
        "object_name": "TO-196"
    }, {
        "object_uid": "-SVSorvKTeiY8PPcIbjPyA",
        "mac_address": "c001a0006004",
        "event_info": "{\"contact_uid\":\"eUkfBCoXSdahkAfvI9WPxQ\",\"contact_name\":\"John Doe\", \"contact_mac\":\"e4956ea50a1f\",\"minimal_distance\":1000,\"severity_level\":2,\"duration\":16}",
        "event_type": "pws",
        "ts": "2020-06-06T12:00:04.000Z",
        "area_uid": null,
        "project_uid": "VMKRetiPRDKm0zUHDQ5x6g",
        "x": null,
        "y": null,
        "z": null,
        "object_name": "TO-196"
    }]
}

Errors

Error Status Error Type Error Body Error Description
422 Unprocessable Entity {"message":"Incorrect query","name":"UnprocessableEntityError"} A required field is missing from the request.

results matching ""

    No results matching ""