Using the api
You can use the api to get the current status of your devices,
You can also send commands and data to your devices.
See the examples below:
list all devices
$ curl 'https://www.offbeat-iot.com/api/devices' -i -u 'username:password' -X GET
and you will see
[ {
"friendlyName" : "Light",
"description" : "Light in living room",
"endpointId" : "max4fGz5",
"connectedSince" : "1 m 32 seconds ago",
"currentValues" : {
"powerstate" : "on"
},
"connected" : true
}, {
"friendlyName" : "Thermostat",
"description" : "Thermostat in dining room",
"endpointId" : "HXXCzHh1",
"connectedSince" : "Not connected",
"currentValues" : {
"humidity" : "72",
"temp" : "21"
},
"connected" : false
} ]
you can also see status for one device
$ curl 'https://www.offbeat-iot.com/api/devices/0ZfQWrN4' -i -u 'username:password' -X GET
and you will see
{
"friendlyName" : "Light",
"description" : "Light in living room",
"endpointId" : "0ZfQWrN4",
"connectedSince" : "1 m 32 seconds ago",
"currentValues" : {
"powerstate" : "on"
},
"connected" : true
}
if you want to send data to your device, you can do it using http GET
$ curl 'https://www.offbeat-iot.com/api/devices/iMNaYM6Q?volume=up' -i -u 'username:password' -X GET
and you will see
{
"friendlyName" : "Light",
"description" : "Light in living room",
"endpointId" : "iMNaYM6Q",
"connectedSince" : "1 m 32 seconds ago",
"currentValues" : {
"powerstate" : "on"
},
"connected" : true
}
you can also do it using http POST with the data in the body
$ curl 'https://www.offbeat-iot.com/api/devices/sPVyLM0g' -i -u 'username:password' -X POST \
-d 'volume=up'
and you will see
{
"friendlyName" : "Light",
"description" : "Light in living room",
"endpointId" : "sPVyLM0g",
"connectedSince" : "1 m 32 seconds ago",
"currentValues" : {
"powerstate" : "on"
},
"connected" : true
}