Device
Retrieve a single device from the Meshblu registry.
Retrieve a device from the Meshblu device registry by it's uuid
. In order to retrieve a target device, your connection must be authenticated as a device that is in the target device's discover.view
whitelist. See the Meshblu whitelist documentation for more information.
Event: "device"
, query
, callback
"device"
, query
, callback
query
Query object, must contain only theuuid
property.uuid
UUID of the device to retrieve.
callback
Function that will be called with aresult
.result
Object passed to the callback. Contains either thedevice
orerror
key, but never both.device
The full device record from the Meshblu registry.error
String explaining the what went wrong. Is only present if something went wrong
Check the permissions
Your device must exist in the other device's
discover.view
whitelist or no device will be returned. See the Meshblu whitelist documentation for more information.
No 404
In Meshblu, it is not possible to distinguish between a device not existing and not having permission to view a device. In most of the Meshblu API calls, the error in both cases yields the protocol-specific equivalent of an
HTTP 404: Not Found
. The Socket.IO API, however, returns the errorForbidden
. This is for backwards compatibility and will likely change with the next major version release of the Socket.IO API.
Successful Response
When requesting a valid device that the authorized device may view:
{
"device": {
"uuid": "26de691f-8068-4cdc-907a-4cb5961a1aba",
"online": true,
"color": "green"
}
}
Error Response
When requesting a non-existing device, or a device the authenticated device may not view:
{
"error": "Forbidden"
}
Updated less than a minute ago