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.
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 interval_type above
intervalstring,optional15minhour, 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
}
}
 
    • Related Articles

    • API Endpoint: aggregate_site_interval_facts

      aggregate_site_interval_facts Returns an array of interval facts for a site over a given span of time. Parameters Example Call (Energy Usage) Example Response (Energy Usage) Example Call (Occupancy) Example Response (Occupancy) Parameters Field Type ...
    • API Terms

      Overview This article provides definitions of terms that are critical to understand when using the SiteWorx API. Terms ID All resources in SiteWorx are identified by a unique ID. They are represented as alpha-numeric strings (e.g. 3EVHgjWw46E.) ...
    • API Endpoint: aggregate_sensor_data

      aggregate_sensor_data Returns sensor data aggregated over time for a given data_source or sensor. The aggregate_sensor_data endpoint can be used to retrieve data from power meters and environmental sensors in SiteWorx Sense. Parameters Example Call ...
    • API Endpoint: aggregate_site_light_energy

      aggregate_site_light_energy Returns the total energy used (in Watt-hours) by all of the light nodes in the site over the specified time period. Similar to aggregate_site_interval_facts with interval=day and interval_type=1, but sums the total energy ...
    • CSV Example

      CSV Example By default, the API endpoints return data in JSON format. Example JSON queries can be found in the API Endpoints section. Most endpoints also support the option to return the data in CSV format. This is enabled by setting the Accept ...