{"id":20040,"date":"2017-07-14T13:44:54","date_gmt":"2017-07-14T18:44:54","guid":{"rendered":"http:\/\/www.multitech.net\/developer\/?page_id=20040"},"modified":"2019-09-03T15:27:18","modified_gmt":"2019-09-03T20:27:18","slug":"example-update-a-device","status":"publish","type":"page","link":"https:\/\/www.multitech.net\/developer\/software\/devicehq\/account-api\/account-api-examples\/example-update-a-device\/","title":{"rendered":"Example &#8211; Update a Device"},"content":{"rendered":"<p>Although a large amount of information is available when reading a device through the API, a very limited set of items can be updated through it. This is because device updates are designed to be executed by the device directly when it checks in and updates on DeviceHQ.com.<\/p>\n<p>Fields updateable through the API\/v2 interface include &#8220;description,&#8221; &#8220;group,&#8221; and &#8220;location_description&#8221;. These can be viewed at devicehq.com, under the device\/edit page for a given device. &#8220;Description&#8221; and &#8220;group&#8221; are simply arbitrary strings.<\/p>\n<p>&#8220;location_description&#8221; should be an array of [latitude, longitude]<\/p>\n<ul>\n<li>PUT \/api\/v2\/devices\/(serial or UUID)\n<ul>\n<li>Accepts updated information for the device and returns the device. Only fields changeable in\u00a0DeviceHQ<sup>\u00ae<\/sup> can be changed in the API.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>Example:<\/h4>\n<p>PUT \/api\/v2\/devices\/12345678<br \/>\nContent-Type: application\/json<br \/>\nAccept: application\/json<\/p>\n<pre class=\"brush:xml\">{\r\n  \"data\": {\r\n    \"id\": \"12345678\",\r\n    \"type\": \"devices\",\r\n    \"attributes\": {\r\n      \"description\": \"Device installed in building 33\"\r\n      \"location_description\": [44.211, -92.12],\r\n      \"group\": \"product test\"\r\n    }\r\n  }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Although a large amount of information is available when reading a device through the API, a very limited set of items can be updated through it. This is because device updates are designed to be executed by the device directly when it checks in and updates on DeviceHQ.com. Fields updateable through the API\/v2 interface include [&hellip;]<\/p>\n","protected":false},"author":2082,"featured_media":0,"parent":20000,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-20040","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/20040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/users\/2082"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/comments?post=20040"}],"version-history":[{"count":6,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/20040\/revisions"}],"predecessor-version":[{"id":28475,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/20040\/revisions\/28475"}],"up":[{"embeddable":true,"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/pages\/20000"}],"wp:attachment":[{"href":"https:\/\/www.multitech.net\/developer\/wp-json\/wp\/v2\/media?parent=20040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}