Skip to content

Create occupancy report

Request

Create a report of occupancy counts for a given time range and set of monitors.

Security
api_key
Bodyapplication/jsonrequired

request occupancy data for a set of monitors and a given time range.

endDatestring, (date)

It is the upper bound of the date range for which to return data. The endDate is non-inclusive; i.e, the returned data will be for dates from startDate to endDate-1.

isOpenboolean

Flag to filter output within site opening hour window

Default:false
limitinteger

Number of rows of returned data. A 0 value returns all rows in the requested time range.

metricsArray of strings

List of metrics associated with the monitors.

Items Enum:"occupancy_avg""occupancy_max""in_count_sum""out_count_sum"
occupancyMonitorIdsArray of strings, (uuid)

List of occupancy monitor ids in the report. At least one id is required.

startDatestring, (date)

It is the lower bound of the date range for which to return data. The startDate is inclusive; i.e, the returned data will be for dates from startDate to endDate-1.

timeGrainstring

The time window in the requested range for data aggregation. Time grains below 1h are only available for the most recent 6 months of data. When startDate is more than 6 months in the past only 1h, 6h and 24h are accepted; such requests are served from hourly rollups which may exclude the most recent day.

Default:"1m"
Enum:"1m""5m""15m""30m""1h""6h""24h"
curl -i -X POST \
  https://coreapi.hoxton.ai/_mock/v1/occupancy-reports \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "endDate": "2019-08-24",
    "isOpen": false,
    "limit": 0,
    "metrics": [
      "occupancy_avg"
    ],
    "occupancyMonitorIds": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ],
    "startDate": "2019-08-24",
    "timeGrain": "1m"
  }'

Responses

OK.

Bodyapplication/json
Array [
inCountSuminteger or nullread-only
occupancyAvginteger or nullread-only
occupancyMaxinteger or nullread-only
occupancyMonitorIdstring, (uuid)read-only
outCountSuminteger or nullread-only
timestring, (date-time)read-only
]
Response
[ { "inCountSum": 0, "occupancyAvg": 0, "occupancyMax": 0, "occupancyMonitorId": "51bf4310-39f9-49d3-99c1-c643ff9c2f04", "outCountSum": 0, "time": "2019-08-24T14:15:22Z" } ]