MX Administrative Interface: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
== The API interface ==
 
The current data is transferred from the MX engine to the Admin interface as a JSON string accessed via a Application Program Interface (api). To see the full content type into your browser the same IP reference as for the admin interface and add a few more items i.e. something like <tt>http://192.168.1.x:y/api/data/currentdata</tt> and you may need to look at your hub or router to see what to use for x and y as they represent the device where MX is running.
 
To see the full content of the api for an individual web page in the admin interface,
Many browsers (e.g Firefox) allow you to specify the type of a file you want to view. So if you specify json as the type this will make the browser show it in a long but fairly readable format. This api is how the current data (now.html) page in the admin interface gets its data. Each table cell contains a span element and each span element is given an id attribute whose value matches one of the items in the json stream coming via the api.
#type into your browser the same IP reference as for the admin interface and
#add a few more items
#*i.e. something like <tt>http://192.168.1.x:y/api/data/currentdata </tt> for the api that is how the current data (now.html) page in the admin interface gets its data
#there is more information on [[Cumulus_MX_Local_API|Local API page]].
 
Again you may need to look at your hub or router to see what to use for x and y as they represent the device where MX is running.
 
Many browsers (e.g Firefox) allow you to specify the type of a file you want to view. So if you specify '''json''' as the type, this will make the browser show it in a long but fairly readable format. This api is how the current data (now.html) page in the admin interface gets its data. Each table cell contains a span element and each span element is given an id attribute whose value matches one of the items in the json stream coming via the api.
 
Each table cell (on a admin interface page that lists your weather data in a tabular format), contains a span element. Each span element is given an '''id attribute''' whose value matches one of the items in the json stream coming via the api.
 
This same api can be used to get weather data into another device, although you may prefer to use MQTT instead as that is more easily customised to just share the few weather values you might want.
===Technical aside===
 
When reading the support forum (or articles in this Wiki), you may see mention of AJAX and WebSocketsWeb Sockets. They are both methods of exchanging information between a web page and the data source. In the Cumulus MX context, theyand representexplained two ways of updating the data shown on an admin interface page like '''nowbelow.html''' or ''todayyest.html''.
 
In the Cumulus MX context, they represent two ways of updating the data shown on an admin interface page like '''now.html''' or ''todayyest.html''.
*Steve Loft's MX beta builds used different ports for the two methods, and allowed you to pick which ports were used and which way was used.
*Mark's builds use the same port for both methods, although there is still an optional parameter (when issuing the command to run MX) that can change the port used.
**The latest MX releases use web sockets for updating admin interface pages that you have open, as the "engine" is coded to send updated data on a regular interval (less often in newer releases).
 
'''Asynchronous JavaScript and XML''' (AJAX) is the widely used name for what Microsoft invented as '''XMLHttpRequest''' (late 1999, Internet Explorer 5.0). Now it is implemented in all browsers, and no longer purely a Microsoft feature. Put as simply as I can, it lets code (written into JavaScript) ask for updated information from the Cumulus MX engine to update the numbers on the web page. This is used in the data log editing pages to see if any line update has been successful.
 
Asynchronous JavaScript and XML (AJAX) isIn the widelylegacy usedCumulus name for what Microsoft invented as '''XMLHttpRequest''' (late 19991, Internet Explorer 5.0) now it is implemented in all browsers and no longer purely Microsoft feature. Put as simply as I can, it lets code written into JavaScript ask for updated information from the Cumulus MX engine to update the numbers on the web page. In the standard Cumulus 1its trends.htm web page, AJAX was used to load an updated graph into the web page each time the client pressed a button requesting a graph.
 
WebSockets is an improvement on AJAX. While AJAX needs the client to make a request before an update can be made, WebSockets adds the option that the source can generate the request and do a remote update. Thus when you open ''todayyest.html'', the MX engine gets a request from that web page to insert the various sub-tables into that web page. Subsequently, when WebSocket use is enabled, the MX engine sends updates with new figures, until you close the web page and a '''Connection Closed''' message is sent instead.
5,838

edits

Navigation menu