{"_id":"558f87726742610d0051c4f5","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","user":"5564f227f0f70f0d00a9ab20","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"},"__v":3,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-28T05:34:42.658Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":15,"body":"Update a device in the Meshblu device registry. In order to update a target device, your connection must be authenticated as a device that is in the target device's `configure.update` whitelist. See the [Meshblu whitelist documentation](https://meshblu.readme.io/docs/whitelists-2-0) for more information.\n\n### Event: `\"update\"`, `query`, `callback`\n\n* `query/update` Both the query and update object. Must contain at least a `uuid`. Other than the listed exceptions, all other parameters will overwrite the device in the registry.\n  * `uuid` UUID of the device to update. If omitted, it defaults to the UUID of the authenticated connection.\n* `callback` Function that will be called with a `result`.\n  * `result` Object passed to the callback.\n    * `uuid` The uuid of the device that was updated.\n    * `status` Status code of the update operation. Will always be `200`, even if the update did not happen.\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Risk of Overwrite\",\n  \"body\": \"v1.0 of update does not allow for atomic updates using the '$' prefix operators. This means you may run into the classic Read Write race condition. See the [HTTP](https://meshblu-http.readme.io/) or [XMPP](https://meshblu-xmpp.readme.io/) APIs if you need of that functionality.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Successful Response\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"uuid\\\": \\\"78159106-41ca-4022-95e8-2511695ce64c\\\",\\n  \\\"status\\\": 200\\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]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"uuid\\\": \\\"i-made-this-uuid-up\\\",\\n  \\\"status\\\": 200\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"error-response.json\"\n    }\n  ]\n}\n[/block]","excerpt":"Update a device record","slug":"update","type":"basic","title":"Update"}

Update

Update a device record

Update a device in the Meshblu device registry. In order to update a target device, your connection must be authenticated as a device that is in the target device's `configure.update` whitelist. See the [Meshblu whitelist documentation](https://meshblu.readme.io/docs/whitelists-2-0) for more information. ### Event: `"update"`, `query`, `callback` * `query/update` Both the query and update object. Must contain at least a `uuid`. Other than the listed exceptions, all other parameters will overwrite the device in the registry. * `uuid` UUID of the device to update. If omitted, it defaults to the UUID of the authenticated connection. * `callback` Function that will be called with a `result`. * `result` Object passed to the callback. * `uuid` The uuid of the device that was updated. * `status` Status code of the update operation. Will always be `200`, even if the update did not happen. [block:callout] { "type": "danger", "title": "Risk of Overwrite", "body": "v1.0 of update does not allow for atomic updates using the '$' prefix operators. This means you may run into the classic Read Write race condition. See the [HTTP](https://meshblu-http.readme.io/) or [XMPP](https://meshblu-xmpp.readme.io/) APIs if you need of that functionality." } [/block] [block:api-header] { "type": "basic", "title": "Successful Response" } [/block] [block:code] { "codes": [ { "code": "{\n \"uuid\": \"78159106-41ca-4022-95e8-2511695ce64c\",\n \"status\": 200\n}\n", "language": "json", "name": "response.json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Error Response" } [/block] [block:code] { "codes": [ { "code": "{\n \"uuid\": \"i-made-this-uuid-up\",\n \"status\": 200\n}\n", "language": "json", "name": "error-response.json" } ] } [/block]