API Records Data and Cumulus MX Local API: Difference between pages

From Cumulus Wiki
(Difference between pages)
Jump to navigationJump to search
(Created page with "''Back to Cumulus MX Local API'' == All Time Records == The all time records data response is designed for displaying on a web page, the text is formatted with HTML codes...")
 
No edit summary
 
Line 1: Line 1:
There are two methods of calling the Cumulus MX local API (note the web tag names are case sensitive just like normal):
''Back to [[Cumulus MX Local API]]''


== All Time Records ==
== General API - HTTP GET ==
This provides a quick and simple method of getting data, you just provide the web tag names in the GET URL and MX returns a simple JSON string with the tag-name:tag-value pairs.
The all time records data response is designed for displaying on a web page, the text is formatted with HTML codes.
The tags are always returned with the default format. You can specify a special parameter "rc" (which must be the first URL parameter) to apply the usual remove commas format to all the tags.


eg.
The general format of the records data API request is as follows...
<pre>http://localhost:8998:/api/records/alltime/xxxxx</pre>
<pre>http://localhost:8998/api/tags/process.json?temp&hum&dew</pre>
or
Where xxxx is the specific request as below:
<pre>http://localhost:8998/api/tags/process.json?rc&temp&hum&dew</pre>


Which will return the following format string in the body...
=== temperature.json ===
{"temp":"15.8","hum":"73","dew":"10.5"}
Returns all time temperature records. An example response is given below...
{
"data": [
["High temperature", "34.6 &deg;C", "25 July 2019 15:39"],
["Low temperature", "-12.5 &deg;C", "20 December 2010 07:17"],
["High dew point", "23.7 &deg;C", "25 July 2019 16:35"],
["Low dew point", "-13.5 &deg;C", "20 December 2010 07:20"],
["High apparent temp", "38.7 &deg;C", "25 July 2019 16:35"],
["Low apparent temp", "-15.8 &deg;C", "20 December 2010 07:17"],
["High feels like", "37.6 &deg;C", "25 July 2019 16:40"],
["Low feels like", "-12.5 &deg;C", "20 December 2010 07:20"],
["High Humidex", "42.0 &nbsp;", "12 August 2020 14:12"],
["Low wind chill", "-12.5 &deg;C", "20 December 2010 07:17"],
["High heat index", "40.2 &deg;C", "25 July 2019 16:35"],
["Highest minimum temp", "18.8 &deg;C", "06 September 2016 04:07"],
["Lowest maximum temp", "-4.4 &deg;C", "20 December 2010 00:00"],
["High daily temp range", "21.3 &deg;C", "26 March 3912"],
["Low daily temp range", "0.9 &deg;C", "19 January 2017"]
]
}


Note, ALL values are quoted as strings as it is difficult to know which are numeric and which are not.
=== humidity.json ===
Returns all time humidity records. An example response is given below...
{
"data": [
["High humidity", "100 %", "23 January 2010 01:10"],
["Low humidity", "17 %", "25 March 2017 14:19"]
]
}



=== pressure.json ===
== General API - HTTP POST ==
The POST method allows you to put whatever text you like in the request body - and include any web tags plus formatting you wish. The string returned will be exactly the same text with the tags substituted with data.
So you could send a simple comma separated list, or some JSON text, or XML, whatever.

eg.
<pre>http://localhost:8998/api/tags/process.txt</pre>

With a POST body text of..
<#time format="yy/MM/dd hh:mm:ss">,<#temp>,<#RecentFeelsLike d=1>
would return...
20/07/14 01:48:11,15.7,18.4

or
{
{
"DateTime:"<#time format="yy/MM/dd hh:mm:ss">",
"data": [
"OutsideTemp":<#temp>,
["High pressure", "1048.5 hPa", "20 January 2020 00:09"],
"FeelsLikeYest":<#RecentFeelsLike d=1>
["Low pressure", "962.9 hPa", "15 February 2014 00:13"]
]
}
}
would return...

=== wind.json ===
{
{
"data": [
"DateTime:"20/07/14 01:50:56",
"OutsideTemp":15.7,
["High gust", "53.0 mph", "12 February 2014 17:32"],
"FeelsLikeYest":18.4
["High wind speed", "25.0 mph", "12 February 2014 17:35"],
["High daily windrun", "352.9 miles", "31 March 2015"]
]
}
}



=== rain.json ===
== Predetermined Data ==
{
=== Graph Data ===
"data": [
Cumulus MX will return graph data on request, it is formatted as JSON, please refer to this page [[API Graph Data]]
["High rain rate", "230.4 mm/hr", "29 April 2016 01:52"],
=== Records Data ===
["High hourly rain", "29.0 mm", "16 June 2016 16:09"],
Cumulus will return weather records on request, it is formatted as JSON, [please refer to this page [[API Records Data]]
["High daily rain", "44.6 mm", "16 June 2016"],
=== Today/Yesterday Data ===
["Highest monthly rainfall", "170.6 mm", "October 2013"],
Cumulus will return weather data on request, it is formatted as JSON, [please refer to this page [[API Today/Yesterday Data]]
["Longest dry period", "26 days", "12 July 2018"],
["Longest wet period", "33 days", "19 January 2014"]
]
}

Revision as of 14:46, 18 October 2020

There are two methods of calling the Cumulus MX local API (note the web tag names are case sensitive just like normal):

General API - HTTP GET

This provides a quick and simple method of getting data, you just provide the web tag names in the GET URL and MX returns a simple JSON string with the tag-name:tag-value pairs. The tags are always returned with the default format. You can specify a special parameter "rc" (which must be the first URL parameter) to apply the usual remove commas format to all the tags.

eg.

http://localhost:8998/api/tags/process.json?temp&hum&dew

or

http://localhost:8998/api/tags/process.json?rc&temp&hum&dew

Which will return the following format string in the body...

{"temp":"15.8","hum":"73","dew":"10.5"}

Note, ALL values are quoted as strings as it is difficult to know which are numeric and which are not.


General API - HTTP POST

The POST method allows you to put whatever text you like in the request body - and include any web tags plus formatting you wish. The string returned will be exactly the same text with the tags substituted with data. So you could send a simple comma separated list, or some JSON text, or XML, whatever.

eg.

http://localhost:8998/api/tags/process.txt

With a POST body text of..

<#time format="yy/MM/dd hh:mm:ss">,<#temp>,<#RecentFeelsLike d=1>

would return...

20/07/14 01:48:11,15.7,18.4

or

{
   "DateTime:"<#time format="yy/MM/dd hh:mm:ss">",
   "OutsideTemp":<#temp>,
   "FeelsLikeYest":<#RecentFeelsLike d=1>
}

would return...

{
   "DateTime:"20/07/14 01:50:56",
   "OutsideTemp":15.7,
   "FeelsLikeYest":18.4
}


Predetermined Data

Graph Data

Cumulus MX will return graph data on request, it is formatted as JSON, please refer to this page API Graph Data

Records Data

Cumulus will return weather records on request, it is formatted as JSON, [please refer to this page API Records Data

Today/Yesterday Data

Cumulus will return weather data on request, it is formatted as JSON, [please refer to this page API Today/Yesterday Data