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" : "l9NgyTPc",
"connectedSince" : "1 m 32 seconds ago",
"currentValues" : {
"powerstate" : "on"
},
"connected" : true
}, {
"friendlyName" : "Thermostat",
"description" : "Thermostat in dining room",
"endpointId" : "HMkNVrgi",
"connectedSince" : "Not connected",
"currentValues" : {
"temp" : "21",
"humidity" : "72"
},
"connected" : false
} ]
you can also see status for one device
$ curl 'https://www.offbeat-iot.com/api/devices/iDDk2YBd' -i -u 'username:password' -X GET
and you will see
{
"friendlyName" : "Light",
"description" : "Light in living room",
"endpointId" : "iDDk2YBd",
"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/n6SIr9jl?volume=up' -i -u 'username:password' -X GET
and you will see
{
"friendlyName" : "Light",
"description" : "Light in living room",
"endpointId" : "n6SIr9jl",
"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/c6xriWEV' -i -u 'username:password' -X POST \
-d 'volume=up'
and you will see
{
"friendlyName" : "Light",
"description" : "Light in living room",
"endpointId" : "c6xriWEV",
"connectedSince" : "1 m 32 seconds ago",
"currentValues" : {
"powerstate" : "on"
},
"connected" : true
}