NEAR MISS EVENTS

Use the Near Miss Events API to get reports with near miss events of specified area in a specified time frame.

Limitations

The number of simultaneously running Near Miss Events generation processes, including the reports, is limited to 3 (three).

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

Near Miss Events Endpoints

Functionality Method Endpoint
create near miss events report POST api/near_miss/
get near miss events report status GET api/near_miss/status/{uid}
get near miss events report GET api/near_miss/{uid}

Endpoints

Create Near Miss Events report

POST api/near_miss/

Create a Near Miss Events report. This report returns near miss events for trackables in the specified area within the specific timeframe.

Request Fields

Field Required/Optional Values Type Description
to required - number The end timestamp of the report, in milliseconds.
from required - number The start timestamp of the report, in milliseconds.
distance required - number Minimal distance to generate near-miss event, in millimeters. The minimal value is 500 mm, and can be increased in increments of 100 mm.
project_uid required - string The unique identifier of the project. Deprecated and will be removed in 2021Q2
sublocation_uid required - string The unique identifier of the area.

Response Fields

Field Description
reportUid The unique identifier of the near miss events report.

Request Example

{
    "sublocation_uid": "2Mb9auXPSO_2C739PId0zQ",
    "project_uid": "VMKRetiPRDKm0zUHDQ5x6g",
    "from": 1582272000000,
    "to": 1582284780000,
    "distance": 5000
}

Response Example

{
  "reportUid": "8NSbseJ5TTeyBDI-J6l9hw"
}

Get Near Miss Events report status

GET api/near_miss/status/{uid}

Using the report UID that was created in the create near miss events report request, retrieve the report status using the GET method. This route returns percentage complete (0 - 99%) of near miss events report generation status.

Response Fields

Field Description
id The identifier of the report.
id_txt The unique identifier of the report.
request A report request information.
status The progress percentage of report generation.
status2 Reserved field.
uid The unique identifier of the report.
error Any error which occurs during report generation. If no error occurs, it returns null.
input A JSON object with information about the input for the report.
input.to The end timestamp of the report, in milliseconds.
input.from The start timestamp of the report, in milliseconds.
input.project_uid The unique identifier of the project.
input.sublocation_uid The unique identifier of the area.
input.distance Minimal distance to generate near-miss event, in millimeters.
input.reportUid The unique identifier of the near miss report.
output Reserved field

Example Response

{
    "id": 11523,
    "id_txt": "9_FtcHGUTeGgMUcOb8muhw",
    "request": "#statistic {\"type\":\"near_miss\"}",
    "status": 100,
    "status2": 0,
    "uid": "9_FtcHGUTeGgMUcOb8muhw",
    "error": null,
    "input": {
        "sublocation_uid": "2Mb9auXPSO_2C739PId0zQ",
        "project_uid": "VMKRetiPRDKm0zUHDQ5x6g",
        "from": 1582272000000,
        "to": 1582284780000,
        "distance": 5000,
        "reportUid": "9_FtcHGUTeGgMUcOb8muhw"
    },
    "output": null
}

Get Near Miss Events report

GET api/near_miss/{uid}

Using the report UID that was created in the create near miss events report request, retrieve the report using the GET method. This report returns your project's near miss events generated for a specific area within the specific timeframe.

Response Fields

Field Description
events A list of generated near miss events.
events.distance The minimal distance between trackables for the event, in millimeters.
events.duration The event duration, in seconds.
events.ts The event generation timestamp, in seconds.
events.ms The event generation timestamp, in milliseconds.
events.type The event type.
events.trackables The list of trackables generated during the event.
events.trackables.uid The unique identifier of a trackable object.
events.trackables.driver_uid The unique identifier of a driver. When there is no driver the value is equal to null.
events.trackables.x The x coordinate of the trackable, in millimeters, at the moment of event generation.
events.trackables.y The y coordinate of the trackable, in millimeters, at the moment of event generation.
trackableObjects A list of trackable objects.
trackableObjects.uid The unique identifier of a trackable object.
trackableObjects.name The name of a trackable object.
trackableObjects.category The trackable`s category:
  • VEHICLE
  • PERSON

Example Response

{
  "events": [
    {
      "distance": 1156,
      "duration": 9,
      "ts": 1582276781,
      "ms": 460,
      "type": "near-miss",
      "trackables": [
        {
          "uid": "IVn7QvoTR-OGC3g0vdHtfA",
          "driver_uid": null,
          "x": 10000,
          "y": 7620
        },
        {
          "uid": "ww80OgNNSrKmSkVDT2Eqmw",
          "driver_uid": "9H21WyX0QTWjVgrjPEAt5g",
          "x": 11000,
          "y": 12000
        }
      ]
    },
    {
      "distance": 2396,
      "duration": 8,
      "ts": 1582276975,
      "ms": 833,
      "type": "near-miss",
      "trackables": [
        {
          "uid": "IVn7QvoTR-OGC3g0vdHtfA",
          "drived_uid": null,
          "x": 15000,
          "y": 9520
        },
        {
          "uid": "ww80OgNNSrKmSkVDT2Eqmw",
          "driver_uid": "9H21WyX0QTWjVgrjPEAt5g",
          "x": 11000,
          "y": 12000
        }
      ]
    }
  ],
  "trackableObjects": [
    {
      "name": "Rick Richards",
      "category": "PERSON",
      "uid": "IVn7QvoTR-OGC3g0vdHtfA"
    },
    {
      "name": "Track A",
      "category": "VEHICLE",
      "uid": "ww80OgNNSrKmSkVDT2Eqmw"
    },
    {
      "name": "John Doe",
      "category": "PERSON",
      "uid": "9H21WyX0QTWjVgrjPEAt5g"
    }
  ]
}

Errors

Error Status Error Type Error Body Error Description
422 Unprocessable Entity {"message":"...","name":"ValidationError", "status": 422, "details": [...]} Required field missing from the request.
403 Forbidden {"message":"The sublocation "..." for project "..." not found", "name":"ForbiddenError"} The sublocation uid does not match any sublocation in the specified project.
404 NotFoundError {"message":"Report "..." not found", "name":"NotFoundError"} The report with the specified uid not found.

results matching ""

    No results matching ""