Webtags (preserving history): Difference between revisions

m
Line 659: Line 659:
[[File:Badge vMx.png]] Available from version 3.7.0 (build 3089).
[[File:Badge vMx.png]] Available from version 3.7.0 (build 3089).


== Where to use ==


This is meant for services either on the same computer as Cumulus or on your local network. It is not secure, and should not be available, nor requested, via any external network or the internet.


In earlier versions of Cumulus if you wanted to make use of values processed by Cumulus, you wrote a script file referencing the web tags you wanted to use. Now if you are running other software on your device that runs MX (or a computer or other device linked directly on your personal network), you can request web tags values on demand via an application programming interface (api hereafter). Obviously this creates a processing overhead on Cumulus so use this feature wisely.
== "GET" approach ==
You may have used GET as an attribute when defining the action of a HTML form.  Equally you might in a script language access the query-string part of a Universal Resource Locator.  Even if you don't understand the meaning of those technical terms, you probably have seen when using a browser a question mark (?) followed by one or [separated by ampersand (&)] more '''name=value''' parameters.
The GET approach to using the api works in this way indicating the start of a query-string with a question mark and using ampersands to separate names. The difference is that a tag name is used instead of a name=value parameter. 
Suppose you want to get the values for the following three web tags:
# <#RCtemp>
# <#RChum>
# <#RCdew>
Then the URL with query-string to use is '''http: //localhost:8998/api/tags/process.json?rc&temp&hum&dew'''
Obviously, if you have started MX with a port parameter like this:
<pre>sudo mono CumulusMX.exe -port 9999</pre>
then you change the 8998 port shown in the URL for the api to use the port you have selected e.g. '''http: //localhost:9999/api/tags/process.json?rc&temp&hum&dew'''
The first parameter is '''rc''' to indicate that the tags that follow are to use decimal points not decimal commas, which is how many script languages expect to see values.
Remember that in this version (and some earlier versions) of MX, the above three web tags are exactly same as:
# <#temp rc=y>
# <#hum rc=y>
# <#dew rc=y>
Since '''rc=y'''  can be applied to several web tags that don't appear in [[Webtags#No_Commas]] table, this shows how the api can access values without commas for many other web tags.
If you are using the api in a context where it does not matter if decimal commas or decimal points are in the api, simply omit the '''rc''' as first item, and just include tag names separated by ampersands.


=The Web Tags for Cumulus =
=The Web Tags for Cumulus =
5,838

edits