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:

  1. WQDataLIVE project must be made public (via public portal option).
  2. Requests are limited to once every 3 seconds.
  3. 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:

  1. URL: https://www.wqdatalive.com/public/{projectId}/data
  2. Request
    1. Method: Post
    2. Content Type: application/x-www-form-urlencoded
    3. Parameters:
      Parameter NameTypeDescription
      paramIDIntegerRequired ID of parameter
  1. Response
    1. Code: 200 on success
    2. Content Type: application/json
    3. Content:
      FieldTypeDescription
      errorbool

      If present,

      false – successful request
      true – the request failed either because,

          1. Data is not accessible to the public
          2. No data exists for the request
      timezonestring

      Timezone used for public portal

      dataarrayArray of data format. The data is sorted in ascending order.

      • [[timestamp (milliseconds), value (string)],…]
      tableDataarrayArray 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)],…]
        • aoColumns: array of data for table header in format
          • [[name (string), targets (array), title (string), width (string)],…]
    1. Note:
      1. data is used for rendering the graph. tableData is used for the data table display.
      2. data and tableData will not present at all if error is true
      3. timezone string is from the php time zone library. For a list of supported time zone, see PHP timezones

Examples

  1. 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"
}

 

  1. Empty dataset or invalid request (i.e. public portal is not enabled)
{
	"error": true
}