Reporting API Overview
Last updated
Last updated
The Butlr Reporting API is a RESTful API designed to provide time-series occupancy data, making it ideal for analyzing historical trends in space utilization. This API is optimized for standardized reporting, enabling users to aggregate data across floors, rooms, or zones to manage and optimize physical spaces efficiently. Use this API to track occupancy patterns over time or analyze historical trends, enabling data-driven decisions that enhance space management strategies.
When using the Reporting API v3, adhering to the recommended practices ensures data accuracy and provides meaningful insights. Proper configuration of parameters such as windowing functions, timezones, and filters directly impacts the granularity and relevance of your results.
Recommended Practices
Function Selection for Occupancy Metrics:
Use the max
function to capture peak values within the specified time window.
Use the mean
function to capture average values within the specified time window.
Traffic Metrics: Use the sum
function to aggregate the total entries and exits over the defined period.
Avoid Relative Time Queries: Do not use relative time functionality (e.g., -5m
) as it may result in missing data depending on query timing. Always specify absolute start and stop times.
Timezone Configuration: Always provide a timezone when querying traffic-based occupancy
Include Zero Values in Output: To ensure zero values are included in the results, add the filter:
The following example demonstrates how to retrieve traffic-based floor occupancy data using the Reporting API.
POST https://api.butlr.io/api/v3/reporting
Window Parameters:
"every": "1h"
: Specifies a 1-hour window size.
"function": "sum"
: Aggregates the total entries and exits during each 1-hour window.
"timezone": "America/New_York"
: Local timezone of the space.
Filter Parameters:
"start": "2024-01-01T04:00:00"
: The start time of the query period in the specified timezone.
"stop": "2024-01-02T04:00:00"
: The end time of the query period.
"measurements": ["traffic_floor_occupancy"]
: Specifies the metric to retrieve.
"spaces": {"eq": ["space_XXXX"]}
: Filters the query to the specific floor (replace space_XXXX
with the floor ID).
"value": { "gte": 0 }
: Ensures zero values are included in the results.
Group By:
"order": ["time"]
: Groups and orders results by the specified time intervals.
Window Size:
Adjust "every": "1h"
to smaller intervals like "5m"
or "1m"
for more granular data.
Aggregation Function:
Use "max"
for occupancy metrics to capture peak values within a time range.
Use "mean"
for average occupancy within a time range.
Use "sum"
for traffic metrics to calculate total flow within a time range.
Measurements:
Replace "traffic_floor_occupancy"
with other metrics, such as "room_occupancy"
or "zone_occupancy"
, depending on the desired level of granularity and deployed sensor mode.
Time Range:
Modify "start"
and "stop"
to align with your analysis period.
For real-time updates, subscribe to real-time webhooks to receive instant notifications of changes to occupancy or traffic metrics. Real-time data complements historical queries by enabling live monitoring and immediate action.