REPORTS

Overview

Use the Reports API to:

  • Retrieve a list of reports available for a specific site
  • Get the information for a specific report

Notes

Reports are site based and generated by schedule.

  • If the site has an active shift the report will be generated at the end of the shift, with a 5 minute delay. For example, if a shift ends at 10:00, the report information will be available at 10:05.
  • If the site has no active shifts the report will be generated at the end of the day. "End of day" will be determined by the project timezone.

HTTP Headers

The HTTP headers used to access all RTLS APIs are listed below. Before submitting requests to the Reports 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

Reports Endpoints

Functionality Method Endpoint
get reports list GET api/report?site_uid={site_uid}&from={iso_date}&to={iso_date}&type={report_type}
get report GET api/report/{uid}

Endpoints

Get reports list

GET api/report?site_uid={site_uid}&from={iso_date}&to={iso_date}&type={report_type}

Request Fields

Field Required/Optional Values Type Description
site_uid required - string The unique identifier of the site.
from required - string The time stamp that marks the beginning of the time frame. Timestamp is in ISO 8601 format.
to required - string The time stamp that marks the end of the time frame. Timestamp is in ISO 8601 format.
type required - string The report type. Options are:
  • attendance_report
  • alarms_report
  • distance_report
  • zone_activity_report

Response Fields

Field Description
reports A list of JSON objects with information about the report generated for a requested parameter (i.e., timeframe, site and type).
reports.uid The unique identifier of the report.
reports.start The start time of the period the report was generated for. Timestamp is in ISO 8601 format.
reports.end The end time of the period the report was generated for. Timestamp is in ISO 8601 format.
reports.shift A JSON object with information about the shift the report was generated for. When no active shift is specified for a location, the shift is for the entire day.
reports.shift.name The shift name.
reports.shift.start The CRON string indicating the start of the shift.
reports.shift.end The CRON string indicating the end of the shift.
reports.shift.expected_others The number of expected trackables for a shift.
reports.shift.expected_vehicles The number of expected vehicles for a shift.
reports.shift.expected_person The number of expected workers for a shift.
reports.shift.active The flag which is indicates the shift activity.

Request Example

GET api/report?from=2020-09-09T21:00:00.000Z&to=2020-09-10T20:59:59.999Z&site_uid=h6Rw7vhiTgavkZtARHNH4A&type=distance_report

Response Example

{
  "reports": [
    { 
      "uid": "dE4P6oqSRzK59iIbo19zNw",
      "start": "2020-09-09T21:00:00.000Z",
      "end": "2020-09-10T05:00:00.000Z",
      "shift": {
        "name": "Night",
        "start": "00 00 * * *",
        "end": "00 08 * * *",
        "active": true,
        "expected_others": 10,
        "expected_vehicles": 10,
        "expected_person":10
      }
    },
    {
      "uid": "SxoHsIJpStWKu8vNH_dEIQ",
      "start": "2020-09-09T05:00:00.000Z",
      "end": "2020-09-10T13:00:00.000Z",
      "shift": {
         "name": "Morning",
         "start": "00 08 * * *",
         "end": "00 16 * * *",
         "active": true,
         "expected_others": 10,
         "expected_vehicles": 10,
         "expected_person":10
      }
    }
  ]
}

Get report

GET api/report/{uid}?file={true||false}

Request Fields

Field Required/Optional Values Type Description
uid required - string The unique identifier of the report.
file optional - boolean The flag that indicates the response data format. Used only for attendance_report. When set to true the response will be a JSON stream.

Response Fields

Field Description
uid The unique identifier of the report.
site_uid The unique identifier of the site report was generated for.
site_name The name of the site report was generated for.
start The start of the period the report was generated for. Timestamp is in ISO 8601 format.
end The end of the period the report was generated for. Timestamp is in ISO 8601 format.
shift A JSON object with information about the shift the report was generated for. When no shift is specified for a location, the shift is the entire day.
data The JSON object that contains the report data. Specific for a report type.

Request Example (Distance Report)

GET api/report/8Dbj2OBmTiyeRgkM5B7l9g?file=false

Response Example

  {
    "uid": "8Dbj2OBmTiyeRgkM5B7l9g",
    "start": "2020-09-09T21:00:00.000Z",
    "end":  "2020-09-10T08:50:00.000Z",
    "site_uid": "h6Rw7vhiTgavkZtARHNH4A",
    "site_name": "Location 1",
    "shift": {
      "name": "Morning",
      "start": "00 00 * * *",
      "end": "50 11 * * *",
      "active": true,
      "expected_others": 10,
      "expected_vehicles": 10,
      "expected_person": 10
    },
    "data": {
      "ranges": [
        1599688800000,
        1599692400000,
        1599696000000,
        1599699600000,
        1599703200000,
        1599706800000,
        1599710400000,
        1599714000000,
        1599717600000,
        1599721200000,
        1599724800000,
        1599727800000
      ],
      "trackables": [
          {
            "uid": "9VDax9YQToONLInJFQaNdQ",
            "name": "TO-28",
            "category": null,
            "distances": [0,0,0,0,0,0,0,0,0,0,0,852148],
            "totalDistance": 852148
          },
          {
            "uid": "f86LqFGPSyyjfkPAY5WPdQ",
            "name": "TO-16",
            "category": null,
            "distances": [0,0,0,0,0,0,0,0,0,0,0,461056],
            "totalDistance": 461056
          }
      ]
    }
  }

Request Example (Attendance Report)

GET api/report/TYftrJ8MRB6T4hgAiYH4vQ?file=true

Response Example

{
  "shift": {
    "name":"Morning",
    "start":"00 00 * * *",
    "end":"45 11 * * *",
    "active":true,
    "expected_others":10,
    "expected_vehicles":10,
    "expected_person":10
  },
  "project_name":"Project-1",
  "project_uid":"VMKRetiPRDKm0zUHDQ5x6g",
  "type":"attendance_report",
  "site_name":"Location 1",
  "site_uid":"h6Rw7vhiTgavkZtARHNH4A",
  "uid":"TYftrJ8MRB6T4hgAiYH4vQ",
  "start":"2020-09-09 21:00:00.000",
  "end":"2020-09-10 08:45:00.000",
  "data":{
    "uid":"h6Rw7vhiTgavkZtARHNH4A",
    "trackableObjects": {
      "FLItYAPZQQ2lXWUZUNB-zA":{
        "idle_periods":[{"start":"2020-09-09T21:00:00.000Z","end":"2020-09-10T08:05:24.731Z"},{"start":"2020-09-10T08:37:20.061Z","end":"2020-09-10T08:45:00.000Z"}],
        "totalIdle":40384670,
        "active_periods":[],
        "totalActive":0,
        "unresponsive_periods":[{"start":"2020-09-10T08:05:24.731Z","end":"2020-09-10T08:37:20.061Z","i":0}],
        "totalUnresponsive":1915330,
        "name":"Trackable One",
        "category":"PERSON"
      },
      "mcXrnA2-T0q5ltNJSCJU3g":{
        "idle_periods":[{"start":"2020-09-09T21:00:00.000Z","end":"2020-09-10T08:05:24.731Z"},{"start":"2020-09-10T08:37:21.136Z","end":"2020-09-10T08:45:00.000Z"}],
        "totalIdle":40383595,
        "active_periods":[],
        "totalActive":0,
        "unresponsive_periods":[{"start":"2020-09-10T08:05:24.731Z","end":"2020-09-10T08:37:21.136Z","i":0}],
        "totalUnresponsive":1916405,
        "name":"Trackable Two",
        "category":null
      },
      "iaJdm1o4TGSIaodqr_Rw8Q":{
        "idle_periods":[],
        "totalIdle":0,
        "active_periods":[{"start":"2020-09-09T21:00:00.000Z","end":"2020-09-10T08:05:24.731Z"},{"start":"2020-09-10T08:37:21.142Z","end":"2020-09-10T08:45:00.000Z"}],
        "totalActive":40383589,
        "unresponsive_periods":[{"start":"2020-09-10T08:05:24.731Z","end":"2020-09-10T08:37:21.142Z","i":0}],
        "totalUnresponsive":1916411,
        "name":"TO-13",
        "category":"PERSON"
      }
    }
  }
}

Request Example (Attendance Report)

GET api/report/TYftrJ8MRB6T4hgAiYH4vQ

Response Example

{
  "uid":"TYftrJ8MRB6T4hgAiYH4vQ",
  "start":"2020-09-09 21:00:00.000",
  "end":"2020-09-10 08:45:00.000",
  "site_uid":"h6Rw7vhiTgavkZtARHNH4A",
  "site_name":"Location 1",
  "shift": {
    "name":"Morning",
    "start":"00 00 * * *",
    "end":"45 11 * * *",
    "active":true,
    "expected_others":10,
    "expected_vehicles":10,
    "expected_person":10
  },
  "data":{
      "FLItYAPZQQ2lXWUZUNB-zA":{
        "name":"Trackable One",
        "category":"PERSON",
        "totalIdle":40384670,
        "totalActive":0
      },
      "mcXrnA2-T0q5ltNJSCJU3g":{
        "name":"Trackable Two",
        "category":null,
        "totalIdle":40383595,
        "totalActive":0
      },
      "iaJdm1o4TGSIaodqr_Rw8Q":{
        "name":"TO-13",
        "category":"PERSON",
        "totalIdle":0,
        "totalActive":40383589
      }
    }
}

Request Example (Alarms Report)

GET api/report/G9VN3sYRRMiLv_zaWA5Aiw

Response Example

{
    "uid": "tJzgLpNQQCq0JzbStAcs6Q",
    "start": "2020-09-09T21:00:00.000Z",
    "end": "2020-09-10T08:45:00.000Z",
    "site_uid": "h6Rw7vhiTgavkZtARHNH4A",
    "site_name": "Location 1",
    "shift": {
        "name": "Morning",
        "start": "00 00 * * *",
        "end": "45 11 * * *",
        "active": true,
        "expected_others": 10,
        "expected_vehicles": 10,
        "expected_person": 10
    },
    "data": [{
        "from": 1602249000000,
        "to": 1602250200000,
        "name": "Trackable One",
        "category": "PERSON",
        "uid": "FLItYAPZQQ2lXWUZUNB-zA",
        "count": 1,
        "zone_violation_duration": 0,
        "zone_violations": [],
        "buffer_violation_duration": 2031,
        "buffer_violations": [{
            "zone_uid": "wScSwaZZQY6LzPNlzC4pOQ",
            "zone_name": "Buffer (TO-15)",
            "severity": 1,
            "zone_type": "keep_out",
            "count": 1,
            "accumulated_duration": 2031
        }],
        "emergency_button": { "count": 0, "accumulated_duration": 0 }
    }, {
        "name": "Trackable Two",
        "category": "PERSON",
        "uid": "iaJdm1o4TGSIaodqr_Rw8Q",
        "count": 1193,
        "zone_violation_duration": 62262319,
        "zone_violations": [{
            "zone_uid": "U8_BpxuuTW6eREw1fKKZpA",
            "zone_name": "dsdad",
            "severity": 1,
            "zone_type": "keep_out",
            "count": 1088,
            "accumulated_duration": 62262319
        }],
        "buffer_violation_duration": 307380,
        "buffer_violations": [{
            "zone_uid": "wScSwaZZQY6LzPNlzC4pOQ",
            "zone_name": "Buffer (TO-15)",
            "severity": 1,
            "zone_type": "keep_out",
            "count": 105,
            "accumulated_duration": 307380
        }],
        "emergency_button": { "count": 0, "accumulated_duration": 0 }
    }]
}

Request Example (Zone Activity Report)

GET api/report/EzG4fhrNR7iGEKlZwsO8lw

Response Example

{
    "uid": "mW0iQ_h8SAmRXWqMSL6T1Q",
    "start": "2020-09-09T21:00:00.000Z",
    "end": "2020-09-10T08:45:00.000Z",
    "site_uid": "h6Rw7vhiTgavkZtARHNH4A",
    "site_name": "Location 1",
    "shift": {
        "name": "Morning",
        "start": "00 00 * * *",
        "end": "45 11 * * *",
        "active": true,
        "expected_others": 10,
        "expected_vehicles": 10,
        "expected_person": 10
    },
    "data": {
        "area_uids": ["2Mb9auXPSO_2C739PId0zQ", "PJnC_-CYTfuQNC4QrYibRQ"],
        "trackables": [{
            "from": 1602249000000,
            "to": 1602250200000,
            "name": "Trackable One",
            "category": "PERSON",
            "uid": "iaJdm1o4TGSIaodqr_Rw8Q",
            "count": 620,
            "duration": 5558196,
            "entries": [{
                "zone_uid": "UxYpKMKaT8ybIdMpHDOZkA",
                "zone_name": "Info Zone",
                "count": 620,
                "accumulated_duration": 5558196
            }]
        }, {
            "name": "Trackable Two",
            "category": "UNSPECIFIED",
            "uid": "np_WXgDxTSq8E4UurIQVTA",
            "count": 28,
            "duration": 198668637,
            "entries": [{
                "zone_uid": "UxYpKMKaT8ybIdMpHDOZkA",
                "zone_name": "Info Zone",
                "count": 28,
                "accumulated_duration": 198668637
            }]
        }]
    }
}

Errors

Error Status Error Type Error Body Error Description
401 Unauthorized {"message":"User not authorized", "code":"AUTHORIZATION_ERROR"} User does not have access to the resource.
404 Not found {"message":"Report '...' not found", "code":"NOT_FOUND_ERROR"} Could not find the report in the database.
422 Unprocessable Entity {"message":"...", "code":"VALIDATION_ERROR"} Validation error.

results matching ""

    No results matching ""