API Endpoint: aggregate_site_interval_facts

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
FieldTypeDdescription
site_idstringUnique id of site
start_timeintegerStart time for report (Unix Epoch format)
end_timeintegerEnd 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 (Energy Usage)
Return the daily (interval=day) energy usage (interval_type=1) for Office Site (site_id=486P8TBZpNE) from 18 June 2018 (start_time=1560830400) through 21 June 2018 (end_time=1561435200). Both times are aligned with local midnight.

GET https://example-backend.siteworx.io/api/v1/aggregate_site_interval_facts?site_id=486P8TBZpNE&interval=day&interval_type=1&start_time=1560830400&end_time=1561089600
Example Response (Energy Usage)
Notes
Note: sum_data is the energy usage in Watt-hours for each interval. The fact_count and updated_at fields can be ignored, they are used internally.

{
"data": [
{
"fact_count": 0,
"interval_start": 1560830400,
"interval_type": 1,
"sum_data": 4648.345231999996,
"updated_at": "0001-01-01T00:00:00Z"
},
{
"fact_count": 0,
"interval_start": 1560916800,
"interval_type": 1,
"sum_data": 7267.4056759999885,
"updated_at": "0001-01-01T00:00:00Z"
},
{
"fact_count": 0,
"interval_start": 1561003200,
"interval_type": 1,
"sum_data": 5938.892697999994,
"updated_at": "0001-01-01T00:00:00Z"
}
],
"meta": {
"count": 3
}
}
Example Call (Occupancy)
Return the 15 minute (interval=15min) occupancy (interval_type=5) for Office Site (site_id=486P8TBZpNE) from 18 June 2018 9:00am (start_time=1560859200) through 18 June 2018 10:00am (end_time=1560866400). Both times are aligned with local midnight.

GET https://example-backend.siteworx.io/api/v1/aggregate_site_interval_facts?site_id=486P8TBZpNE&interval=15min&interval_type=5&start_time=1560859200&end_time=1560866400
Example Response (Occupancy)
Notes
Note: sum_data is the site average occupancy for each interval, in the range 0.0 to 1.0. The fact_count and updated_at fields can be ignored, they are used internally.

{
"data": [
{
"fact_count": 6,
"interval_start": 1560859200,
"interval_type": 5,
"sum_data": 0.1751828146654579,
"updated_at": "0001-01-01T00:00:00Z"
},
{
"fact_count": 6,
"interval_start": 1560860100,
"interval_type": 5,
"sum_data": 0.1345009499267987,
"updated_at": "0001-01-01T00:00:00Z"
},
... 4 record omitted ...
{
"fact_count": 6,
"interval_start": 1560864600,
"interval_type": 5,
"sum_data": 0.06800441630002019,
"updated_at": "0001-01-01T00:00:00Z"
},
{
"fact_count": 6,
"interval_start": 1560865500,
"interval_type": 5,
"sum_data": 0.05482882373076407,
"updated_at": "0001-01-01T00:00:00Z"
}
],
"meta": {
"count": 8
}
}
 
    • Related Articles

    • 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 field type description tag_id string Unique id of Tag start_time integer Start time for ...
    • 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 ...
    • 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: site_list

      site_list Returns an array of site_info structs with information about each Site in your Organization. Further information can be found in the API Endpoint: site_info article.
    • 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 ...