How can Active Places open data in JSON format be used?
The following provides a guide to using Active Places open data in JSON format.
1. How to access Active Places data in JSON format
The Active Places data in JSON format can be accessed via the "Open Data" section of Active Places Power https://www.activeplacespower.com/opendata, with a link also available on the site's footer. This page has the options of:
o Data Download: Where a full file of Active Places data in JSON format can be accessed
o API Docs: Where the API and related documentation for ongoing JSON API requests can be accessed
o Change Log: Where details of open data related changes and known issues are published
2. How to get the data to establish local copy of Active Places data
A full file of Active Places data is generated on a daily basis and represents the current data at that point in time. The latest version can be downloaded by accessing https://www.activeplacespower.com/OpenData/download and selecting the "Download JSON" option. Once downloaded, the JSON data file can be used to establish a local copy of Active Places data.
There is no specified JSON schema for the data format; in order to translate and use this information it is highly recommended that users of the data familiarise themselves with the Sports Data Model support documentation (see SDM FAQs).
3. How to maintain a reference to local copy
Once a local copy of Active Places data has been established using the JSON data download file, data updates can be maintained by using Rest API GET requests.
The request URL for the API, which does not require any authentication, is https://api.activeplacespower.com/api/v1/sites. Further information to outline the API and a harness to test requests is available at https://www.activeplacespower.com/OpenData/Api/Docs#!/Sites/Sites_Get.
The JSON data provides a "modified" value per record, which is treated as a timestamp. This does not directly map to a time or date, but is an incremental value that reflects changes in the database (i.e. for every change in the database, the "modified" timestamp value increments by one). The JSON data download file provides results in ascending order, so the "modified" value of the final record in the download file needs to be identified. This can then be used as the "afterTimeStamp" input parameter for the API request. The number of results to be returned per page is set to a default of 10 and the "limit" input parameter can be used to modify this (up to a maximum of 100).
The API response results should be applied as updates to the local copy which was established based on the full file data download. The process can then be repeated on an ongoing basis at the user defined frequency (i.e. identify the last "modified" value returned in the previous response and use this as the input criteria for the next request). In this way Active Places data can be maintained.