{"_id":"558f7986f795be2d00c1164f","project":"556742591c38390d00698087","category":{"_id":"5567425a1c38390d0069808b","project":"556742591c38390d00698087","__v":16,"pages":["5567425c1c38390d0069808d","558f782c1311b80d00ba9d97","558f7986f795be2d00c1164f","558f8069f795be2d00c11655","558f810bf795be2d00c11657","558f82e11311b80d00ba9da1","558f850df795be2d00c1165b","558f85401311b80d00ba9da3","558f85df1311b80d00ba9da5","558f87726742610d0051c4f5","558f87f26742610d0051c4f7","558f886df795be2d00c1165f","55918fec5631432f002d357e","559191f34e50b50d0019612a","5592c8d89a68220d00f1c404","559efaebdf92223500dc50e7"],"version":"5567425a1c38390d0069808a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-28T16:29:14.942Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"__v":13,"user":"5564f227f0f70f0d00a9ab20","parentDoc":null,"version":{"_id":"5567425a1c38390d0069808a","project":"556742591c38390d00698087","__v":2,"createdAt":"2015-05-28T16:29:14.412Z","releaseDate":"2015-05-28T16:29:14.412Z","categories":["5567425a1c38390d0069808b","57214d354758d90e009e6638"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-28T04:35:18.705Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"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](https://meshblu.readme.io/docs/whitelists-2-0) for more information.\n\n### Event: `\"device\"`, `query`, `callback`\n\n* `query` Query object, must contain only the `uuid` property.\n  * `uuid` UUID of the device to retrieve.\n* `callback` Function that will be called with a `result`.\n  * `result` Object passed to the callback. Contains either the `device` or `error` key, but never both.\n    * `device` The full device record from the Meshblu registry.\n    * `error` String explaining the what went wrong. Is only present if something went wrong\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Check the permissions\",\n  \"body\": \"Your device must exist in the other device's `discover.view` whitelist or no device will be returned. See the [Meshblu whitelist documentation](https://meshblu.readme.io/docs/whitelists-2-0) for more information.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"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 error `Forbidden`. This is for backwards compatibility and will likely change with the next major version release of the Socket.IO API.\",\n  \"title\": \"No 404\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Successful Response\"\n}\n[/block]\nWhen requesting a valid device that the authorized device may view:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"device\\\": {\\n    \\\"uuid\\\": \\\"26de691f-8068-4cdc-907a-4cb5961a1aba\\\",\\n    \\\"online\\\": true,\\n    \\\"color\\\": \\\"green\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"response.json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Error Response\"\n}\n[/block]\nWhen requesting a non-existing device, or a device the authenticated device may not view:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"error\\\": \\\"Forbidden\\\"\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"error-response.json\"\n    }\n  ]\n}\n[/block]","excerpt":"Retrieve a single device from the Meshblu registry.","slug":"device","type":"basic","title":"Device"}

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](https://meshblu.readme.io/docs/whitelists-2-0) for more information. ### Event: `"device"`, `query`, `callback` * `query` Query object, must contain only the `uuid` property. * `uuid` UUID of the device to retrieve. * `callback` Function that will be called with a `result`. * `result` Object passed to the callback. Contains either the `device` or `error` 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 [block:callout] { "type": "warning", "title": "Check the permissions", "body": "Your device must exist in the other device's `discover.view` whitelist or no device will be returned. See the [Meshblu whitelist documentation](https://meshblu.readme.io/docs/whitelists-2-0) for more information." } [/block] [block:callout] { "type": "info", "body": "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 error `Forbidden`. This is for backwards compatibility and will likely change with the next major version release of the Socket.IO API.", "title": "No 404" } [/block] [block:api-header] { "type": "basic", "title": "Successful Response" } [/block] When requesting a valid device that the authorized device may view: [block:code] { "codes": [ { "code": "{\n \"device\": {\n \"uuid\": \"26de691f-8068-4cdc-907a-4cb5961a1aba\",\n \"online\": true,\n \"color\": \"green\"\n }\n}", "language": "json", "name": "response.json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Error Response" } [/block] When requesting a non-existing device, or a device the authenticated device may not view: [block:code] { "codes": [ { "code": "{\n \"error\": \"Forbidden\"\n}\n", "language": "json", "name": "error-response.json" } ] } [/block]