CSV Example

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 header to text/csv. This returns a URL pointing to a remote temporary file containing the result. You must then fetch this URL. Note that the temporary file expires after 24 hours.

This example performs the aggregate_site_interval_fact occupancy query with a resulting CSV file. This example call consists of Part 1 and Part 2.
Example Call (Part 1 - Data Prep)
Example Response (Part 1)
Example Call (Part 2 - Fetch CSV)
Example Response (Part 2)
 
    • Related Articles

    • How to Use the API

      Overview SiteWorx offers a web-based REST API to authenticate, make requests, and retrieve data from both lighting nodes in SiteWorx Tune and sensor nodes in SiteWorx Sense. The following data types are available: Lighting nodes Lighting energy usage ...
    • 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_info

      site_info Returns information about a Site in your Organization. Variables Parameters Example Call Example Response Variables Field Type Description id string Unique database id for this site name string Site name address string Site address ...
    • 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 ...