API Endpoint: aggregate_tag_interval_facts

API Endpoint: aggregate_tag_interval_facts

aggregate_tag_interval_facts

Returns an array of interval facts for a specific Tag over a given span of time. Information on how to create assign nodes to tags within SiteWorx can be found here.
Parameters
Example Call
Example Response
Parameters
FieldTypeDescription
tag_idstringUnique id of Tag
start_timeintegerStart time for report (Unix Epoch format)
end_timeintegerStart time for report (Unix Epoch format)
interval_typeintegerSee API terms article
intervalstring,optional15min, hour, or day (defaults to 15min if not specified)
include_minuteboolean,optionalAnnotate each record with the interval start minute-of-hour (0-59)
include_hourboolean,optionalAnnotate each record with the interval start hour-of-day (0-23)
include_dowboolean,optionalAnnotate each record with the interval start day-of-week (0-6)
include_all_onboolean,optionalInclude all_on_wh value (default false)
full_occ_databoolean,optionalInclude active, inactive and sensor time in occupancy (interval_type = 5) replies (default false)
Example Call
Return the hourly (interval=hour) energy usage (interval_type=1) for the Main Lights tag (tag_id=5CBswh1EF7Z) for 17 Feb 2023 9:00am (start_time=1676642400) through 17 Feb 2023 5:00pm (end_time=1676671200).

GET https://example-backend.siteworx.io/api/v1/aggregate_tag_interval_facts?tag_id=5CBswh1EF7Z&interval=hour&interval_type=1&start_time=1676642400&end_time=1676671200
Example Response
{
"data": [
{
"fact_count": 4,
"interval_start": 1676642400,
"interval_type": 1,
"sum_data": 13.852433281004709,
"updated_at": "0001-01-01T00:00:00Z"
},
{
"fact_count": 4,
"interval_start": 1676646000,
"interval_type": 1,
"sum_data": 41.778335949764525,
"updated_at": "0001-01-01T00:00:00Z"
},
... 4 records omitted ...
{
"fact_count": 4,
"interval_start": 1676664000,
"interval_type": 1,
"sum_data": 42.225641025641025,
"updated_at": "0001-01-01T00:00:00Z"
},
{
"fact_count": 4,
"interval_start": 1676667600,
"interval_type": 1,
"sum_data": 41.68205128205128,
"updated_at": "0001-01-01T00:00:00Z"
}
],
"meta": {
"count": 8
}
}