Public Portal Data API
The Public Portal Data API is designed to pull data from the WQData LIVE My SQL database and directly feed that to the WQDataLIVE public portal display. Learn how to enable and configure the public portal for your project by reading the Configure Public Portal article.
Limitations
The following limitations occur with this API:
- WQDataLIVE project must be made public (via public portal option).
- Requests are limited to once every 3 seconds.
- Data formats are in the form that can be utilized directly by the WQDataLIVE display. Thus, these formats are not orthogonal.
Specifications
The API has the following specifications within the Public Portal:
- URL: https://www.wqdatalive.com/public/{projectId}/data
- Request
- Method: Post
- Content Type: application/x-www-form-urlencoded
- Parameters:
Parameter Name Type Description paramID Integer Required ID of parameter
- Response
- Code: 200 on success
- Content Type: application/json
- Content:
Field Type Description error bool If present,
false – successful request
true – the request failed either because,- Data is not accessible to the public
- No data exists for the request
timezone string Timezone used for public portal
data array Array of data format. The data is sorted in ascending order. - [[timestamp (milliseconds), value (string)],…]
tableData array Array of data for table in format. Data is sorted in descending order. - Timestamp format is always
- mm-dd-yyy hh:mm:ss (UTC [timezone])
- [aaData, aaColumns, axis]
- aaData: array of data with datetime format based on timezone
- [[datatime (string), value (string)],…]
- aaData: array of data with datetime format based on timezone
- aoColumns: array of data for table header in format
- [[name (string), targets (array), title (string), width (string)],…]
- aoColumns: array of data for table header in format
- Note:
- data is used for rendering the graph. tableData is used for the data table display.
- data and tableData will not present at all if error is true
- timezone string is from the php time zone library. For a list of supported time zone, see PHP timezones
- Note:
Examples
- With data:
{ "error": false, "data": [ [1561983000000, "212"], [1561983600000, "204"] ], "tabledata": { "aaData": [ ["07-01-2019 08:20:00 (UTC-04:00)", "204"], ["07-01-2019 08:10:00 (UTC-04:00)", "212"] ], "aoColumns": [{ "name": "Timestamp", "targets": [0], "title": "Timestamp", "width": "220px" }, { "name": "Wind Direction (Degree)", "targets": [1], "title": "Wind Direction (Degree)", "width": "150px" } ] }, "timezone": "America/New_York" }
- Empty dataset or invalid request (i.e. public portal is not enabled)
{ "error": true }