($value, $respcode, $data) = mshttp_call($msno, $command);
Sends a HTTP REST request to the specified Miniserver and returns the status code and value, and also a hashref to the datastructure of the response.
This feature first is available with LoxBerry 1.2.4. Set your LB_MINIMUM version in your plugin.cfg accordingly.
The first parameter is the Miniserver number (numbers are equal to LoxBerry::System::get_miniservers, starting with 1).
The second parameter is a string with the full command, but without hostname, e.g.
|$msno||x||Number of the Miniserver|
|$command||x||The full command. The parameter must be URL-encoded correctly (slashes of the url must not be encoded, but parameters do).|
Return "value" from Miniserver
|2. return||Status code|
A hash reference to the data structure returned by the Miniserver.
As the first return only includes the "value" property, the hashref includes all data.
The function returns three values: The queried "value" (string), The status code (string), and the full, parsed response (hashref).
Status codes not in the 2xx range (below 200 and from 300 upwards) are an error. Normally, Loxone returns a "code" 200 for ok.
As Loxone Miniserver most commonly returns a HTTP statuscode of "200 OK" in the HTTP header - also with wrong syntax or non-existing elements, the function parses the result and returns the "code", a value the Miniserver returns inside of the response XML.
Therefore, the function may return
- a LoxBerry-own "error code" in the 6xx area (e.g. "601" for "Miniserver not defined")
- the HTTP statuscode, if a real HTTP header errorcode is returned
- the Loxone "code" of the response XML (for errors, most used is the 500)
- 200 if the request was successful