How do I query historical occupancy and headcount data?

Step 1

You must have an access_token because the butlr api to extract occupancy or headcount requires a valid JWT

 

Step 2

Identify if you have any activity sensors. You can query the list of sensors by calling our /sensors API.

Example crud:

curl --location --request GET '[<https://api.butlr.io/api/v2/sensors>](<https://api.butlr.io/api/v2/sensors>)' \\
--header 'Authorization: Bearer INSERT_TOKEN'

The data should be located: data[i].mode

 

Step 3

a. For Activity: Query your database on the sensor_id always denoted with sensor_xxxxxxxx

Example crud:

This is an example of querying the last 1day

curl --location --request GET '[<https://api.butlr.io/api/v2/occupancy?space_id=INSERT_SPACEID&start=1d&historical=true>](<https://api.butlr.io/api/v2/occupancy?space_id=space_258AnQ7qt8AuHrjqFIxJn7lT7IA&start=1d&historical=true>)' \\
--header 'Authorization: Bearer INSERT_TOKEN'

b. For Headcount: Query your database on the sensor_id always denoted with sensor_xxxxxxx

Example crud:

This is an example of querying the last 1day

curl --location --request GET '[<https://api.butlr.io/api/v2/headcount?space_id=INSERT_SPACEID&start=1d>](<https://api.butlr.io/api/v2/headcount?space_id=space_258AnQ7qt8AuHrjqFIxJn7lT7IA&start=1d>)' \\
--header 'Authorization: Bearer INSERT_TOKEN'