If you want to use measured values in your own programs, the OUT app JSON provides easy access to channels and measured values. The data are provided in JSON format.
To make access faster and easier, we provide two libraries to access the channels and metrics:
- PHP
- Javascript
So that we can get a measurement super-easy.
PHP
One line of code can be used to access measured values. The “valueid” is the identifier of the measured value, e.g. 91-4. This value can be found in the app tab “Help” or be determined with the function
$valueid = $api->getChannelsResponse()->getChannels()[0]->getValueid();
The value of the sensor can then be determined via the following function.
$value = $api->getValuesResponse($valueid)->getValues()[0]->getValue();
The PHP client and a sample program are available for download at https://github.com/siwiat/out-app-json-client-php
JavaScript
One line of code can be used to access measured values. The “valueid” is the identifier of the measured value, e.g. 91-4. This value can be found in the app tab “Help” or be determined with the function
getChannelsResponse(...)
The value of the sensor can then be determined via the following function.
apiValues.getValuesResponse(data.channels[0].valueid, values_callback);
The JS client and a sample program are available for download at https://github.com/siwiat/out-app-json-client-php
SIWIAT OUT-App JSON
The SIWIAT OUT app JSON must be installed for the examples on the SIWIAT app box. The clients can be installed with GIT.
Development
If you are interested in further developing of the clients for your own purposes: Fork us on Github! I wish you success. We welcome feedback, stars and watches.
JavaScript Client | PHP Client |
---|---|
For further information about the API and SDK have a look at our Out-App JSON Support site.