{"_id":"558f8069f795be2d00c11655","__v":1,"user":"5564f227f0f70f0d00a9ab20","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"},"parentDoc":null,"project":"556742591c38390d00698087","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-28T05:04:41.571Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"Retrieve devices from the Meshblu device registry. 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: `\"devices\"`, `query`, `callback`\n\n* `query` Query object, filters the device that will be returned. With the exception of the following special cases, properties are used as filters. For example, passing a query of `{color: 'red'}` will yield all devices that contain a color key with value 'red' that the authorized connetion has access to.\n  * `online` If present, the value for `online` will be compared against the string \"true\", and the resulting boolean value will be used. *Note: using a boolean value of `true` will be evaluated as `false` because it is not equeal to \"true\"*.\n  * `\"null\"` & `\"\"` If any key is passed in with a value of the string `\"null\"` or the empty string `\"\"`, it will retrieve only devices that do not contain the key at all.\n* `callback` Function that will be called with a `result`.\n  * `result` Object passed to the callback. Contains the `devices` key.\n    * `devices` The devices retrieved from the Meshblu registry.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Check the permissions\",\n  \"body\": \"Your device must exist in the other device's `discoverWhitelist` or no device will be returned.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Succesful Response\"\n}\n[/block]\nWhen requesting valid devices that the authorized device may view:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"devices\\\": [\\n    {\\n      \\\"color\\\": \\\"blue\\\",\\n      \\\"discoverWhitelist\\\": [ \\\"*\\\" ],\\n      \\\"uuid\\\": \\\"c30a7506-7a45-4fe1-ab51-c57afad7f41a\\\"\\n    },\\n    {\\n      \\\"color\\\": \\\"blue\\\",\\n      \\\"discoverWhitelist\\\": [ \\\"*\\\" ],\\n      \\\"uuid\\\": \\\"7a9475ea-a595-42a4-8928-0aeb677c4990\\\"\\n    }\\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\": \"Empty Response\"\n}\n[/block]\nWhen requesting a non-existing devices, or devices the authenticated device may not view:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n\\t\\\"devices\\\": []\\n}\",\n      \"language\": \"json\",\n      \"name\": \"empty-response.json\"\n    }\n  ]\n}\n[/block]","excerpt":"Retrieve devices from the Meshblu registry.","slug":"devices","type":"basic","title":"Devices"}

Devices

Retrieve devices from the Meshblu registry.

Retrieve devices from the Meshblu device registry. 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: `"devices"`, `query`, `callback` * `query` Query object, filters the device that will be returned. With the exception of the following special cases, properties are used as filters. For example, passing a query of `{color: 'red'}` will yield all devices that contain a color key with value 'red' that the authorized connetion has access to. * `online` If present, the value for `online` will be compared against the string "true", and the resulting boolean value will be used. *Note: using a boolean value of `true` will be evaluated as `false` because it is not equeal to "true"*. * `"null"` & `""` If any key is passed in with a value of the string `"null"` or the empty string `""`, it will retrieve only devices that do not contain the key at all. * `callback` Function that will be called with a `result`. * `result` Object passed to the callback. Contains the `devices` key. * `devices` The devices retrieved from the Meshblu registry. [block:callout] { "type": "warning", "title": "Check the permissions", "body": "Your device must exist in the other device's `discoverWhitelist` or no device will be returned." } [/block] [block:api-header] { "type": "basic", "title": "Succesful Response" } [/block] When requesting valid devices that the authorized device may view: [block:code] { "codes": [ { "code": "{\n \"devices\": [\n {\n \"color\": \"blue\",\n \"discoverWhitelist\": [ \"*\" ],\n \"uuid\": \"c30a7506-7a45-4fe1-ab51-c57afad7f41a\"\n },\n {\n \"color\": \"blue\",\n \"discoverWhitelist\": [ \"*\" ],\n \"uuid\": \"7a9475ea-a595-42a4-8928-0aeb677c4990\"\n }\n ]\n}", "language": "json", "name": "response.json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Empty Response" } [/block] When requesting a non-existing devices, or devices the authenticated device may not view: [block:code] { "codes": [ { "code": "{\n\t\"devices\": []\n}", "language": "json", "name": "empty-response.json" } ] } [/block]