The Ignite Prism REST API provides simple, secure, read-only access to your account's data in JSON format via HTTP GET requests over HTTPS.
Changelog
2.3
- change API domain name from
https://api.prism.com/v2/tohttps://api.prismsl.net/v2/
2.2
- add Report Configurations endpoints
- add Reports endpoints
- add Report Data endpoints
- add List of Updated Reports endpoint
2.1
- add Insight Configurations endpoints
- add Insights endpoints
2.0.1
- add Cameras endpoints
- allow some query parameters in the object api to be repeated
- add new query parameters to Sites endpoints
2.0
Backwards incompatible changes
- remove Tripwire Types endpoints and properties (replaced by Data Labels endpoints)
- remove People Counts endpoint (replaced by Data endpoints)
Backwards compatible changes
- add Data Labels endpoints
- add Data endpoints
1.1
- allow the
start&stopquery parameters on the People Count endpoint to be specified without timezone information to automatically use the site's local timezone - add optional
exclude_imputedquery parameter to People Count endpoint - add optional
timezone_modequery parameter to People Count endpoint
1.0
- First stable release of the Ignite Prism API.
Versioning
The Ignite Prism API adheres to the SemVer standard to provide stability to clients integrating with the API.
All urls in the Ignite Prism API include the API major version. The base of all urls of version 2 of the API is https://api.prismsl.net/v2/.
The major version number will be incremented after backward incompatible changes are introduced to the API. A deprecation period will be provided to allow clients to transition from old versions of the API to newer ones.
Backward compatible changes:
- Adding new endpoints to the API
- Exposing new HTTP methods on existing endpoints
- Adding new properties to existing responses
- Changing query parameters from required to optional
Non-backward compatible changes:
- Renaming or removing endpoints
- Renaming, removing, or altering properties of responses
- Removing HTTP methods on existing endpoints
Authentication
To authenticate to the API, your API key must be included in the HTTP Authorization header. The key should be prefixed by the string literal Token, with whitespace separating the two strings. Only access via HTTPS is allowed.
For example:
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/"
Where <key> is to be replaced with your API key. Requests that fail to authenticate will receive an HTTP 401 Unauthorized response.
Keep your key private!
Errors
The Ignite Prism API uses the following HTTP standard error response status codes:
| Status Code | Meaning |
|---|---|
| 400 | Bad Request -- The request was invalid or cannot be otherwise served. An accompanying error message will explain further |
| 401 | Unauthorized -- Your API key is wrong |
| 403 | Forbidden -- The request is understood, but it has been refused or access is not allowed. |
| 404 | Not Found -- The URI requested resource does not exist. |
| 500 | Internal Server Error -- Something is wrong with our stack. Please try again later. |
| 504 | Gateway Timeout -- Something is wrong with our stack. Please try again later. |
The body of all 4** error responses will be a JSON dictionary describing the error. For example, the body of a 403 Forbidden error response might be:
{
"error_status_code": 403,
"error_messages": [
"you do not have permission to access the requested resource"
]
}
The body of 5** error responses will vary and should not be relied on to match any given format.
Sections of the API
The API is broken down into three classes of endpoints.
| Base URL | Description | Details |
|---|---|---|
/ |
API Root | API Root |
/accounts/ |
Object API | Objects |
/data/ |
Data API | Data |
API Root
Accessing the root of the API, /, will return an object describing the current state of the API.
Properties
| Name | Type | Description |
|---|---|---|
| accounts_url | string | Permalink to a list of accessible Accounts. |
| data_url | string | Permalink to the root of data API. |
| version | string | The current version of the API. API versioning follows the SemVer standard. |
Example: retrieve the current state of the api
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/"
{
"accounts_url": "https://api.prismsl.net/v2/accounts/",
"data_url": "https://api.prismsl.net/v2/data/",
"version": "2.0.1+530-2506c7c"
}
Object API
Overview
| URL | Description |
|---|---|
/accounts/ |
List of all Accounts your API key provides access to. |
/accounts/:account_id/ |
Details of a specific Account. |
/accounts/:account_id/sites/ |
List of all Sites for a specific Account. |
/accounts/:account_id/sites/:side_id/ |
Details of a specific Site. |
/accounts/:account_id/zones/ |
List of all Data Labels for a specific account. |
/accounts/:account_id/zones/:zone_id/ |
Details of a specific Data Label. |
/accounts/:account_id/cameras/ |
List of all Cameras for a specific account. |
/accounts/:account_id/cameras/:camera_id/ |
Details of a specific Camera. |
/accounts/:account_id/insight-configurations/ |
List of all Insight Configurations for a specific Account. |
/accounts/:account_id/insight‐configurations/:insight_config_id/insights/ |
List of all Insights for an Insight Configuration for a specific Account. |
/accounts/:account id/insight-configurations/:insight_config_id/insights/:insight_id/ |
Details of a specific Insight. |
/accounts/:account_id/insight-
configurations/:insight_config_id/insights/start_date/:week_start_date/ |
Details of a specific Insight. |
Accounts
Endpoints
| URL | Description |
|---|---|
/accounts/ |
List of all Accounts your API key provides access to. |
/accounts/:account_id/ |
Details of a specific Account. |
Query Parameters
| Name | Format | Description |
|---|---|---|
| name | string | Only consider Accounts with this name. May be repeated. |
Response Properties
| Name | Type | Description |
|---|---|---|
| id | integer | A unique identifier ove rall Account resources. |
| name | string | The human-readable name. |
| sites_url | string | Permalink of the list of Sites for the Account. |
| url | string | Permalink for the Account. Also functions as a unique identifier over all resources, regardless of type. |
| zones_url | string | Permalink of the list of Data Labels available for the Account. |
| cameras_url | string | Permalink of the list of Cameras available for the Account. |
Example: list accounts
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/"
[
{
"id": 1,
"name": "Project Runway",
"sites_url": "https://api.prismsl.net/v2/accounts/1/sites/",
"url": "https://api.prismsl.net/v2/accounts/1/",
"zones_url": "https://api.prismsl.net/v2/accounts/1/zones/"
}
]
Sites
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/sites/ |
Array of all Sites for a specific Account. |
/accounts/:account_id/sites/:side_id/ |
Details of a specific Site. |
Query Parameters
| Name | Format | Description |
|---|---|---|
| defined_zone_id | integer | Only consider Sites that define this Data Label. |
| external_id | string | Only consider Sites with this external_id. |
| name | string | Only consider Sites with this name. |
| timezone | string | Only consider Sites with this IANA timezone. |
| city | string | Only consider Sites with this city. May be repeated. |
| province | string | Only consider Sites with this state/province. May be repeated. |
| country_code | string | Only consider Sites with this country code. May be repeated. |
| postal_code | string | Only consider Sites with this postal code. May be repeated. |
| label | string | Only consider Sites with this label. May be repeated. |
Responses
Either an array of Site objects, or a single Site object. Each Site object has the following properties:| Name | Type | Description |
|---|---|---|
| address | json object | The physical street address of the Site. |
| business_hours | json object | The hours the Site is open. |
| entry_zone_id | integer | The id of the defined Data Label with name entry, if it exists. Else, null. |
| entry_zone_url | string | Permalink to the defined Data Label with name entry, if it exists. Else, null. |
| defined_zones_url | string | Permalink of the list of Data Labels defined for the Site. |
| defined_zone_ids | array of integers | Array of id's of Data Labels defined for the Site. |
| external_id | integer | A string identifier provided by the customer. |
| id | integer | A unique identifier over all Site resources. |
| name | string | The human-readable name. |
| reference_image_url | string | Publicly-accessible url of the configured reference image for the Site. |
| timezone | string | Site timezone. Example: Europe/London. For a list of possible timezones, please see the IANA TimeZone Database. |
| url | string | Permalink for the Site. Also functions as a unique identifier over all resources, regardless of type. |
| labels | array of strings | Array of names of labels associated with this Site. |
| cameras_url | string | Permalink of the list of Cameras in this Site. |
Example: retrieve details for a site
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/sites/2/"
{
"address": {
"line1": "799 Market St",
"line2": "8th Floor",
"city": "San Francisco",
"postal_code": "94103",
"province": "California",
"country_code": "US"
},
"business_hours": {
"monday": {
"close": "21:00:00",
"open": "09:00:00"
},
"tuesday": {
"close": "21:00:00",
"open": "09:00:00"
},
"wednesday": {
"close": "21:00:00",
"open": "09:00:00"
},
"thursday": {
"close": "21:00:00",
"open": "09:00:00"
},
"friday": {
"close": "21:00:00",
"open": "09:00:00"
},
"saturday": {
"close": "21:00:00",
"open": "09:00:00"
},
"sunday": {
"close": "21:00:00",
"open": "09:00:00"
}
},
"defined_zone_ids": [4, 5, 32],
"defined_zones_url": "https://api.prismsl.net/v2/accounts/1/zones/?defined_in_site_id=2",
"entry_zone_id": 5,
"entry_zone_url": "https://api.prismsl.net/v2/accounts/1/zones/5/",
"external_id": "myid",
"id": 2,
"name": "Prism Office",
"reference_image_url": "https://prism-norcal-production.s3.amazonaws.com/1/site-reference-image/2/2015-05-12T15%3A46%3A36.674575%2B00%3A00.jpg?Signature=WmiUCxuR8QbyoJEbeioVO4R%2BOcs%3D&Expires=1435881600&AWSAccessKeyId=AKIAIZG2QTIRLDNE4BIA",
"timezone": "US/Pacific",
"url": "https://api.prismsl.net/v2/accounts/1/sites/2/",
"defined_zone_ids": [
"HQ",
"Office"
],
"cameras_url": "https://api.prismsl.net/v2/accounts/1/cameras/?site_id=2"
}
Data Labels
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/zones/ |
List of all Data Labels for a specific Account. |
/accounts/:account_id/zones/:zone_id/ |
Details of a specific Data Label. |
Query Parameters
| Name | Format | Description |
|---|---|---|
| defined_in_site_id | integer | Only consider Data Label defined in this Site. |
| name | string | Only consider Data Labels with this name. |
Response Properties
| Name | Type | Description |
|---|---|---|
| defined_in_sites_url | string | Permalink of the list of Sites that define this Data Label. |
| defined_in_site_ids | array of integers | Array of id's of Sites which define this Data Label. |
| id | integer | A unique identifier for resources of this type. |
| name | string | The human-readable name. |
| url | string | Permalink for the Data Label. Also functions as a unique identifier over all resources, regardless of type. |
Example: retrieve details for a Data Label
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/zones/2/"
{
"defined_in_site_ids": [8, 9],
"defined_in_sites_url": "https://api.prismsl.net/v2/accounts/10/sites/?defined_zone_id=2",
"id": 2,
"name": "entry",
"url": "https://api.prismsl.net/v2/accounts/10/zones/2/"
}
Cameras
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/cameras |
List of all Cameras for a specific Account |
/accounts/:account_id/cameras/:camera_id/ |
Details of a specific Camera |
Query Parameters
| Name | Format | Description |
|---|---|---|
| name | string | Only consider with this name. May be repeated. |
| label | string | Only consider with this label. May be repeated. |
| site_id | integer | Only consider in this site. May be repeated. |
Responses
Either an array of Camera object, or a single Camera object. Each Camera object has the following properties:| Name | Type | Description |
|---|---|---|
| id | integer | A unique identifier for resources of this type. |
| name | string | The human-readable name of the camera. |
| is_online | boolean | Shows the status of the camera if it is online Trueor notFalse. |
| url | string | Permalink for the Camera. Also functions as a unique identifier over all resources, regardless of type. |
| image_url | string | Reference image for the camera. Not a permanent link; auto- expires in one hour. |
| labels | json object |
Array of names of labels associated with this Camera. |
| is_videocache_enabled | boolean | Indicates whether video recording is enabled or not. |
| site_id | integer | A unique identifier for Site associated with this Camera, null if no associated site. |
| site_name | string | The human-readable name for Site associated with this Camera, null if no associated site. |
| site_url | string | Permalink of Site associated with this Camera, null if no associated site. |
Example: retrieve details for a camera
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/cameras/8/"
{
"id": 8,
"name": "Kitchen Area",
"is_online": true,
"url": "https://api.prismsl.net/v2/accounts/1/cameras/8/",
"image_url": "https://prism-norcal-qa.s3.amazonaws.com/10/views/110/background/2013/02/14/110-background-20130214T214419.419000Z.jpg?",
"labels": [
{
"name": "Food"
},
{
"name": "Fridge"
}
],
"site_id": 12,
"site_name": "The Office",
"site_url": "https://api.prismsl.net/v2/accounts/1/sites/2/"
"is_videocache_enabled": false
}
Insight Configurations
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/insight- configurations/ |
Array of all Insight Configurations for a specific Account. |
Responses
Either an array of Insight Configuration objects or a single Insight Configuration object. Each Insight Configuration object has the following properties:| Name | Type | Description |
|---|---|---|
| id | integer | A unique identifier over all Insight Configuration resources. |
| name | string | Human-readable name. |
| insights_url | string | Permalink for all Insights associate with the Insight Configuration. |
Example: retrieve details for a camera
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/insight-configurations/2/"
{
"id": 2,
"name": "Weekly activity",
"url": "https://api.prismsl.net/v2/accounts/1/cameras/8/",
"insights_url": "https://api.prismsl.net/v2/accounts/1/insight-configurations/2/insights/"
}
Insights
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/insight- configurations/:insight_config_id/insights/ |
Array of all Insights for an Insight Configuration for a specific Account. |
/accounts/:account_id/insight- configurations/:insight_config_id/insights/:insight_id/ |
Details of a specific Insight using id. |
/accounts/:account_id/insight- configurations/:insight_config_id/insights/start_date/:week_start_date/ |
Details of a specific Insight using start date of the week in ISO. |
Query Parameters
| Name | Format | Description |
|---|---|---|
| page | integer, required | Page of results. |
| page_size | integer | How many Insight objects per page. The default is 10. |
Responses
Either an array of Insight objects, or a single Insight object. Each Insight Configuration object has the following properties:| Name | Format | Description |
|---|---|---|
| id | integer | A unique identifier over all Insight Configuration resources. |
| week_start_date | ISO date as string | Naive date indicating the first date from which data is included in the insight. |
| url | string | Permalink for the Insight. |
| image_url | url | Publicly-accessible url of the image that represents the insight. |
Example: Retrieve a list of Insights
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/insight-configurations/2/insights/?page=1"
{
"count": 1,
"next": null,
"previous": null,
"results": [{
"id": 2,
"week_start_date": "2014‐01‐01",
"url": "https://api.prismsl.net/v2/accounts/1/insight‐configurations/2/insights/1/",
"image_url": "https://prism‐norcal‐qa.s3.amazonaws.com/1/insight‐config/2/insights/2014/01/07/110‐background‐20130214T214419.419000"
}]
}
Example: Retrieve details for an Insight
curl -H "Authorization: Token <key>" "https://api.prismsl.net/v2/accounts/1/insight-configurations/2/insights/1/"
{
"count": 2,
"week_start_date": "2014‐01‐01",
"url": "https://api.prismsl.net/v2/accounts/1/insight-configurations/2/insights/1/",
"image_url": "https://prism-norcal-qa.s3.amazonaws.com/1/insight-config/2/insights/2014/01/07/110-background-20130214T214419.4190000"
}
Example: Retrieve details for an Insight by week start date
curl -H "Authorization: Token <key>" "https://api.prismsl.net/v2/accounts/1/insight-configurations/2/insights/start_date/2016-11-27/"
{ "count": 2, "week_start_date": "2016-11-27", "url": "https://api.prismsl.net/v2/accounts/1/insight-configurations/2/insights/1/", "image_url": "https://prism-norcal-qa.s3.amazonaws.com/1/insight-config/2/insights/2014/01/07/110-background-20130214T214419.4190000" }
Report Configurations
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/report-configurations/ |
Array of all Report Configurations for a specific Account. |
/accounts/:account_id/report-configurations/:report_config_id/ |
Details of a specific Report Configuration. |
Responses
Either an array of Report Configuration objects, or a single Report Configuration object. Each Report Configuration object has the following properties:
| Name | Type | Description |
|---|---|---|
| id | integer | A unique identifier over all Report Configuration resources. |
| name | string | Human-readable report name. |
| account_id | integer | A unique identifier for an account. |
| url | string | Permalink for the Report Configuration. |
| site_filters | JSON | List of site_ids and site_names included in reports. |
| recurrence_period | string | Period covered by the report: Daily, Weekly, Monthly. |
| recurrence_frequency | integer | Frequency of the report. |
| start | ISO date as string | Naive date indicating the first date from which data is included in the report. |
| stop_by_date | ISO date as string | Naive date indicating the last date from which data is included in the report. |
| stop_by_runs | integer | The number of times to run this report. |
| hours | JSON | Custom hours to collect data. If hours are not provided, the system uses business hours set for each site. |
| created_at | ISO date/time as string | Date and time when the Report Configuration was created. |
| disabled_at | ISO date as string | Naive date indicating when the Report Configuration was disabled. The system will show null if it is enabled. |
| number_of_reports | integer | The number of generated reports. |
| most_recent_report_url | string | Permalink to the latest report. |
| report_configs_url | string | Permalink to all reports configurations. |
Example: Retrieve details for a Report Configuration
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/report-configurations/2/"
{
"id": 2,
"name": "Entry Count for Prism Office",
"account_id": 1,
"url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/",
"site_filters": {
"site_ids": [
1017
],
"site_name": [
"Prism Office"
]
},
"recurrence_period": "DAILY",
"recurrence_frequency": 1,
"start": "2018-11-01",
"stop_by_date": null,
"stop_by_runs": null,
"hours": null,
"created_at": "2018-11-26T20:26:44.079112Z",
"disabled_at": null,
"number_of_reports": 31,
"most_recent_report_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/2018-12-01/",
"report_configs_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/"
}
Reports
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/report-configurations/:report_config_id/reports/ |
Array of all Reports for a specific Report Configuration. |
/accounts/:account_id/report-configurations/:report_config_id/reports/:report_id/ |
Short version of details of a specific Report. |
/accounts/:account_id/report-configurations/:report_config_id/reports/:start_date/ |
Details of a specific Report based on its start date. |
/accounts/:account_id/report-configurations/:report_config_id/reports/:start_date/:stop_date/ |
Array of Reports within start & stop dates for a specific Report Configuration. |
Responses
Either an array of Report objects, or a single Report object. Report object by start date has the following properties:
| Name | Type | Description |
|---|---|---|
| id | integer | A unique identifier over all Report Configuration resources. |
| url | string | Permalink to the Report. |
| start_date | ISO date as string | Naive date indicating the first date from which data is included in the Report. |
| stop_date | ISO date as string | Naive date indicating the last date from which data is included in the Report. |
| generated_at | ISO date/time as string | Date and time when the Report was created. |
| report_config | JSON | The Report Configuration settings. It includes a permalink to Report Configuration, recurrence_frequency, recurrence_period, report_config id, report name. |
| sites | JSON | List of sites included in the Report. It includes a permalink to each site, site ID, site Name. |
| site_filters | JSON | List of sites included in the Report. |
| zones | JSON | List of data labels included in the Report. |
| metrics | string | List names of metrics included in the Report: COUNT, AVG_DWELL, AVG_0CCUPANCY |
| by_period_data_url | string | Permalink to the data included with this Report where data is grouped by the specified period query param. |
| by_region_data_url | string | Permalink to the data included with this Report where data is grouped by the specified region query param. |
| prev_report_url | string | Permalink to the previous Report. |
| next_report_url | string | Permalink to the next Report. |
| zone_metrics | string | Metrics for each data label. |
Example: Retrieve details for a Report by start date
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/2018-11-26/”
{
"id": 234,
"url": "https://api.prismsl.net/api/v2/accounts/1/report-configurations/2/reports/2018-11-26/",
"start": "2018-11-26",
"stop": "2018-11-26",
"generated_at": "2018-11-25T23:26:44.079112Z",
"report_config": {
"url": "https://api.prismsl.net/api/v2/accounts/1/report-configurations/2/",
"recurrence_frequency": 1,
"recurrence_period": "DAILY",
"id": 2,
"name": "Entry Count for Prism Office"
},
"sites": [
{
"url": "https://api.prismsl.net/api/v2/accounts/1/sites/1017/",
"id": 1017,
"name": "Prism Office"
}
],
"site_filters": [
"Selected Sites: Prism Office"
],
"zones": [
{
"url": "https://api.prismsl.net/v2/accounts/1/zones/6/",
"id": 6,
"name": "entry"
}
],
"metrics": [
"COUNT"
],
"by_period_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/234/by-period/",
"by_region_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/234/by-region/",
"prev_report_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/2018-11-26/",
"next_report_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/2018-11-27/",
"has_valid_data": true,
"zone_metrics": [
"Count: entry"
]
}
Example: List of Reports within start & stop dates
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/2018-11-25/2018-11-26”
{
"id": 233,
"url": "https://api.prismsl.net/api/v2/accounts/1/report-configurations/2/reports/233/",
"start_date": "2018-11-25",
"stop_date": "2018-11-25",
"by_period_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/233/by-period/",
"by_region_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/233/by-region/"
},
{
"id": 234,
"url": "https://api.prismsl.net/api/v2/accounts/1/report-configurations/2/reports/234/",
"start_date": "2018-11-26",
"stop_date": "2018-11-26",
"by_period_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/234/by-period/",
"by_region_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/234/by-region/"
}
Report Data
Data by-period
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/report-configurations/:report_config_id/report_data/:report_id/by-period/ |
Data contained within a specific Report based on report_id, where data is grouped by time period specified period. |
/accounts/:account_id/report-configurations/:report_config_id/report_data/:start_date/by-period/ |
Data contained within a specific Report based on the report's start date, where data is grouped by time period specified period. |
Query Parameters
| Name | Format | Default | Description |
|---|---|---|---|
| format_type | string | json |
The format of the body of the response. Allowed formats: json or csv. |
| period | string | required | Interval of time to group results by. Allowed intervals: minute-15, hour, or day. Results will be provided in the Site's timezone. |
Data by-region
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/report-configurations/:report_config_id/report_data/:report_id/by-region/ |
Data contained within a specific Report based on report_id, where data is grouped by specified region. |
/accounts/:account_id/report-configurations/:report_config_id/report_data/:start_date/by-region/ |
Data contained within a specific Report based on the report's start date, where data is grouped by specified region. |
Query Parameters
| Name | Format | Default | Description |
|---|---|---|---|
| format_type | string | json |
Format of body of response. Allowed formats: json or csv. |
| region | string | required | Physical region to group results by. Allowed regions: site, province, country or datalabel. |
JSON Formatted Response
{
"columns": [<column 1 header as str>, <column 2 header as str>, ...],
"rows": [
[<cell 1x1 value as int/float/str>, <cell 1x2 value as int/float/str>, ...],
[<cell 2x1 value as int/float/str>, <cell 2x2 value as int/float/str>, ...],
]
}
CSV Formatted Response
<column 1 header>,<column 2 header>, ...
<cell 1x1 value>,<cell 1x2 value>, ...
<cell 2x1 value>,<cell 2x2 value>, ...
Examples
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/1/data/by-period/?period=day”
{
"columns": 'Time Period', 'State/Province', 'Country', 'Entry Count'],
"rows": [
["2015-01-02", 'Site 1', 'CA', 'USA', 4],
["2015-01-02", 'Site 2', 'NY', 'USA', 2],
["2015-01-03", 'Site 1', 'CA', 'USA', 2],
["2015-01-03", 'Site 2', 'NY', 'USA', 16],
],
}
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/1/data/by-region/?region=province&format_type=csv”
State/Province,Country,Entry Count
CA,USA,6
NY,USA,18
List of Updated Reports
Endpoints
| URL | Description |
|---|---|
/accounts/:account_id/report-configurations/:report_config_id/reports/changed-since/:since_date_time/ |
List of reports that were updated since specified date & time in UTC |
Example
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/v2/accounts/1/report-configurations/2/reports/changed-since/2018-11-25T12:00/”
{
"id": 234,
"url": "https://api.prismsl.net/api/v2/accounts/1/report-configurations/2/reports/234/",
"start_date": "2018-11-26",
"stop_date": "2018-11-26",
"by_period_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/234/by-period/",
"by_region_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/234/by-region/"
},
{
"id": 233,
"url": "https://api.prismsl.net/api/v2/accounts/1/report-configurations/2/reports/233/",
"start_date": "2018-11-25",
"stop_date": "2018-11-25",
"by_period_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/233/by-period/",
"by_region_data_url": "https://api.prismsl.net/v2/accounts/1/report-configurations/2/report_data/233/by-region/"
}
Data API
Metrics
A data metrics defined what type of data is being queried from the API. Not every metric is available on every endpoint. Available metrics include:
countavg_dwellavg_occupancy
Business Hours
If the client would like the data queries to only consider data in for the business hours of the Site(s) in question, they may specify business_hours_only=True. This has the following effect on the data queries:
- queries whose time range is fully within business hours are unaffected
- for queries whose time range is partially within business hours and partially outside of business hours, only the values within business hours will be considered.
- for queries whose time range is fully outside of business hours, values will be returned as
null.
Datetimes and Timezones
The client must use the query parameters start and stop to specify the range of time they would like the data quer(y/ies) to extend over. The following applies to the start and stop parameters:
- they must be specified in ISO 8601 format
- they may include timezone information. If they don't, then the timezone of the Site being queried will be assumed.
- they must be 'snapped' to the 15-minutes (or, in the case of the
/by-time/endpoint, theperiod). For example:2015-01-07T09:45:00is an acceptable value, while2015-01-07T09:49:56is not.
Daylight Savings Time Transitions
Working in local timezones that have DST transitions introduces a 'missing hour' and a 'duplicate hour'. The 'missing hour' occurs in the spring in the northern hemisphere, while the 'duplicate hour' occurs in the fall.
If the client chooses to specify a start or stop value without a timezone (thus requesting the Site's timezone be used), if that value cannot be converted into a specific moment in time, a 400 error will be returned. For example, specifying a time of 2014-11-02T01:30:00 for a Site in US/Pacific timezone is ambiguous, since this time occurred twice. Similarly, specifying 2015-03-08T02:30:00 for a Site in US/Pacific timezone does not make sense, as this time never occurred.
For /by-time/ queries with period hour or minute-15 that extend over a DST transition, results in the 'missing hour' will have value null. Results in the 'duplicate hour' will be aggregated together.
Endpoint Overview
| URL | Description | Supported Metrics | Details |
|---|---|---|---|
/data/ |
Data from a specific time and a specific defined Data Label. | count |
Basic data query |
/data/by-time/ |
Data from a specific defined Data Label, over a range of times. | count, avg_dwell, avg_occupancy |
Query over a range of time |
/data/by-site/ |
Data from a specific time and Data Label, over a list of Sites. | count |
Query over multiple Sites |
/data/by-zone/ |
Data from a specific time and Site, over a list of Data Labels. | count |
Query over multiple Data Labels |
Basic data query
Endpoint
| URL | Description |
|---|---|
/data/ |
Data from a specific time and a specific defined Data Label. |
Query Parameters
| Name | Format | Default | Description |
|---|---|---|---|
| business_hours_only | boolean | false |
Whether to only consider values from within business hours. |
| metric | string | required, may be repeated | Only one metric currently available: count |
| site_id | integer | required | Identifies the Site to query for. |
| start | ISO datetime as string | required | Indicates when to start the query. Must be 'snapped' to a 15-minute interval. Inclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| stop | ISO datetime as string | required | Indicates when to stop the query. Must be 'snapped' to a 15-minute interval. Exclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| zone_id | integer | required | Identifies the Data Label to query for. |
Response
An object whose keys will corresponds to the requested metrics.
Example: retrieve count for a week during business hours for a defined Data Label
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/data/?zone_id=1&site_id=2&metric=count&business_hours_only=true&start=2014-12-01T00:00:00&stop=2014-12-08T00:00:00"
{
"count": 424
}
Query over a range of time
Endpoint
| URL | Description |
|---|---|
/data/by-time/ |
Data from a specific defined Data Label, over a range of times. |
Query Parameters
| Name | Format | Default | Description |
|---|---|---|---|
| business_hours_only | boolean | false |
Whether to only consider values from within business hours. |
| metric | string | required, may be repeated | One of count, avg_dwell, avg_occupancy. May be repeated to retrieve multiple types of data in one request. |
| period | string | required | Indicates a period of time each query should cover. One of minute-15, hour, or day. |
| site_id | integer | required | Identifies the Site to query for. |
| start | ISO datetime as string | required | Indicates when to start the query. Must be 'snapped' to the period. Inclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| stop | ISO datetime as string | required | Indicates when to stop the query. Must be 'snapped' to the period. Exclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| zone_id | integer | required | Identifies the Data Label to query for. |
Response
An array of objects, each object corresponding to having run a query for the requested metric(s) over one period of time in between the query parameters start and stop. The start and stop keys in the returned object will each be ISO 8601 datetimes localized to the timezone of the Site in question.
Example: retrieve dwell each hour over a morning
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/data/?zone_id=1&site_id=2&metric=count&metric=avg_dwell&period=hour&business_hours_only=true&start=2014-12-01T07:00:00&stop=2014-12-01T12:00:00"
[
{
"start": "2014-12-01T07:00:00",
"stop": "2014-12-01T08:00:00",
"count": null,
"avg_dwell": null
}, {
"start": "2014-12-01T08:00:00",
"stop": "2014-12-01T09:00:00",
"count": 10,
"avg_dwell": 2.41
}, {
"start": "2014-12-01T09:00:00",
"stop": "2014-12-01T10:00:00",
"count": 23,
"avg_dwell": 4.22
}, {
"start": "2014-12-01T10:00:00",
"stop": "2014-12-01T11:00:00",
"count": 27,
"avg_dwell": 3.45
}, {
"start": "2014-12-01T11:00:00",
"stop": "2014-12-01T12:00:00",
"count": 26,
"avg_dwell": 3.21
}
]
Query over multiple Sites
Endpoint
| URL | Description |
|---|---|
/data/by-site/ |
Data from a specific time and Data Label, over a list of Sites. |
Query Parameters
| Name | Format | Default | Description |
|---|---|---|---|
| business_hours_only | boolean | false |
Whether to only consider values from within business hours. |
| metric | string | required, may be repeated | Only one metric currently available: count |
| site_id | integer | required, may be repeated | Identifies the Site to query for. May be repeated to retrieve data from multiple Sites in one request. |
| start | ISO datetime as string | required | Indicates when to start the query. Must be 'snapped' to the period. Inclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| stop | ISO datetime as string | required | Indicates when to stop the query. Must be 'snapped' to the period. Exclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| zone_id | integer | required | Identifies the Data Label to query for. |
Response
An array of objects, each object corresponding to having run a query for the requested metric(s), time period, and Data Label for a particular Site. If the Data Label is not defined for a particular requested Site, null will be returned for all values for that Site.
Example: retrieve count data from for a week for three Sites, one of which doesn't define that Data Label
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/data/?zone_id=1&site_id=2&site_id=7&site_id=8&metric=count
&start=2014-12-01T00:00:00&stop=2014-12-08T00:00:00"
[
{
"site_id": 2,
"count": 42
}, {
"site_id": 7,
"count": null
}, {
"site_id": 8,
"count": 21
}
]
Query over multiple Data Labels
Endpoint
| URL | Description |
|---|---|
/data/by-zone/ |
Data from a specific time and Site, over a list of Data Labels. |
Query Parameters
| Name | Format | Default | Description |
|---|---|---|---|
| business_hours_only | boolean | false |
Whether to only consider values from within business hours. |
| metric | string | required, may be repeated | Only one metric currently available: count |
| site_id | integer | required | Identifies the Site to query for. |
| start | ISO datetime as string | required | Indicates when to start the query. Must be 'snapped' to the period. Inclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| stop | ISO datetime as string | required | Indicates when to stop the query. Must be 'snapped' to the period. Exclusive. If no timezone information is included, the timezone of the site being queried will be used. |
| zone_id | integer | required, may be repeated | Identifies the Data Label to query for. May be repeated to retrieve data from multiple Data Labels in one request. |
Response
An array of objects, each object corresponding to having run a query for the requested metric(s), time period, and Site for a particular Data Label. If the Data Label is not defined for a particular requested Site, null will be returned for all values for that Data Label.
Example: retrieve counts for a week from three Data Labels defined by a particular Site
curl -H "Authorization: Token <key>"
"https://api.prismsl.net/data/?site_id=2&zone_id=2&zone_id=18&zone_id=19&metric=count&start=2014-12-01T00:00:00&stop=2014-12-08T00:00:00"
[
{
"zone_id": 2,
"count": 32
}, {
"zone_id": 18,
"count": 10
}, {
"zone_id": 19,
"count": 22
}
Comments
0 comments
Please sign in to leave a comment.