{"_id":"558f850df795be2d00c1165b","project":"556742591c38390d00698087","__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,"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:24:29.409Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":10,"body":"Register a new device with the Meshblu registry.\n\n### Event: `\"register\"`, `params`, `callback`\n\n* `params` A device object. May not include a `uuid` or `token`. All other properties will be saved to the device on creation. For a description of  the properties that will affect how Meshblu interacts with the device, see the [core Meshblu documentation](https://meshblu.readme.io/docs). If a `uuid` and/or `token` is provided, it will be ignored.\n* `callback` Function that is called with a `device` on registration\n  * `device` The newly registered Meshblu device. Make sure to save the `uuid` and `token`. The `token` will not be made available again as it is not stored in plain-text anywhere by Meshblu.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"The Socket.io implementation of Meshblu creates open devices using the old *(deprecated)* whitelists by default. This is to preserve backwards compatibility. It is strongly recommended to register devices with explicitly locked down [version 2.0.0 whitelists](https://meshblu.readme.io/docs/whitelists-2-0) instead by creating a v2.0.0 device (see the second example).\",\n  \"title\": \"Lock it down\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Save that Token\",\n  \"body\": \"Device registration is the only time your token will be given to you. Be sure to keep it somewhere safe as the token is required to update your device in the future.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Open Response\"\n}\n[/block]\nWhen called with no arguments:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"discoverWhitelist\\\": [\\n    \\\"*\\\"\\n  ],\\n  \\\"configureWhitelist\\\": [\\n    \\\"*\\\"\\n  ],\\n  \\\"sendWhitelist\\\": [\\n    \\\"*\\\"\\n  ],\\n  \\\"receiveWhitelist\\\": [\\n    \\\"*\\\"\\n  ],\\n  \\\"uuid\\\": \\\"5c7392dc-a4ba-4b5a-8c84-5934a3b3678b\\\",\\n  \\\"online\\\": false,\\n  \\\"token\\\": \\\"9e78f644a866e1b5b71d0a2dde912e8662477abf\\\",\\n  \\\"meshblu\\\": {\\n    \\\"createdAt\\\": \\\"2016-05-20T22:10:23+00:00\\\",\\n    \\\"hash\\\": \\\"kt8lmSb5r6ruHG41jqZZHp1CEQvzM1iMJ/kAUppryZo=\\\"\\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\": \"Locked Down Response\"\n}\n[/block]\nWhen called with `{\"meshblu\": {\"version\": \"2.0.0\"}}`\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"uuid\\\": \\\"5c7392dc-a4ba-4b5a-8c84-5934a3b3678b\\\",\\n  \\\"online\\\": false,\\n  \\\"token\\\": \\\"9e78f644a866e1b5b71d0a2dde912e8662477abf\\\",\\n  \\\"meshblu\\\": {\\n    \\\"version\\\": \\\"2.0.0\\\",\\n    \\\"createdAt\\\": \\\"2016-05-20T22:10:23+00:00\\\",\\n    \\\"hash\\\": \\\"kt8lmSb5r6ruHG41jqZZHp1CEQvzM1iMJ/kAUppryZo=\\\"\\n  }\\n}\\n\",\n      \"language\": \"json\",\n      \"name\": \"locked-down-response.json\"\n    }\n  ]\n}\n[/block]","excerpt":"Register a new device record","slug":"register","type":"basic","title":"Register"}

Register

Register a new device record

Register a new device with the Meshblu registry. ### Event: `"register"`, `params`, `callback` * `params` A device object. May not include a `uuid` or `token`. All other properties will be saved to the device on creation. For a description of the properties that will affect how Meshblu interacts with the device, see the [core Meshblu documentation](https://meshblu.readme.io/docs). If a `uuid` and/or `token` is provided, it will be ignored. * `callback` Function that is called with a `device` on registration * `device` The newly registered Meshblu device. Make sure to save the `uuid` and `token`. The `token` will not be made available again as it is not stored in plain-text anywhere by Meshblu. [block:callout] { "type": "warning", "body": "The Socket.io implementation of Meshblu creates open devices using the old *(deprecated)* whitelists by default. This is to preserve backwards compatibility. It is strongly recommended to register devices with explicitly locked down [version 2.0.0 whitelists](https://meshblu.readme.io/docs/whitelists-2-0) instead by creating a v2.0.0 device (see the second example).", "title": "Lock it down" } [/block] [block:callout] { "type": "danger", "title": "Save that Token", "body": "Device registration is the only time your token will be given to you. Be sure to keep it somewhere safe as the token is required to update your device in the future." } [/block] [block:api-header] { "type": "basic", "title": "Open Response" } [/block] When called with no arguments: [block:code] { "codes": [ { "code": "{\n \"discoverWhitelist\": [\n \"*\"\n ],\n \"configureWhitelist\": [\n \"*\"\n ],\n \"sendWhitelist\": [\n \"*\"\n ],\n \"receiveWhitelist\": [\n \"*\"\n ],\n \"uuid\": \"5c7392dc-a4ba-4b5a-8c84-5934a3b3678b\",\n \"online\": false,\n \"token\": \"9e78f644a866e1b5b71d0a2dde912e8662477abf\",\n \"meshblu\": {\n \"createdAt\": \"2016-05-20T22:10:23+00:00\",\n \"hash\": \"kt8lmSb5r6ruHG41jqZZHp1CEQvzM1iMJ/kAUppryZo=\"\n }\n}", "language": "json", "name": "response.json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Locked Down Response" } [/block] When called with `{"meshblu": {"version": "2.0.0"}}` [block:code] { "codes": [ { "code": "{\n \"uuid\": \"5c7392dc-a4ba-4b5a-8c84-5934a3b3678b\",\n \"online\": false,\n \"token\": \"9e78f644a866e1b5b71d0a2dde912e8662477abf\",\n \"meshblu\": {\n \"version\": \"2.0.0\",\n \"createdAt\": \"2016-05-20T22:10:23+00:00\",\n \"hash\": \"kt8lmSb5r6ruHG41jqZZHp1CEQvzM1iMJ/kAUppryZo=\"\n }\n}\n", "language": "json", "name": "locked-down-response.json" } ] } [/block]