{"_id":"556635fd1ec2311900e4c551","user":"5564f227f0f70f0d00a9ab20","parentDoc":null,"project":"55650b9eb893840d004446fe","__v":28,"category":{"_id":"55650b9fb893840d00444702","version":"55650b9eb893840d00444701","pages":["55650b9fb893840d00444704","55662e121ec2311900e4c538","55663058f579050d00c3d42d","556633b61ec2311900e4c544","55663419f579050d00c3d43f","55663490979a3c2500bbafa6","5566352a979a3c2500bbafa8","55663578979a3c2500bbafab","556635fd1ec2311900e4c551","5566365a979a3c2500bbafb3","556636daf579050d00c3d448","5568d269c87afd2500e5254c","556b5b46ab693b1900ce1722","556bbee230922f1700ad5e22","5578af9327f77c0d00fe62ce","567328a458c4890d00bb545f"],"project":"55650b9eb893840d004446fe","__v":16,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-27T00:11:11.144Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"version":{"_id":"55650b9eb893840d00444701","project":"55650b9eb893840d004446fe","__v":2,"createdAt":"2015-05-27T00:11:10.647Z","releaseDate":"2015-05-27T00:11:10.647Z","categories":["55650b9fb893840d00444702","5566a1557acd550d0075e894"],"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-05-27T21:24:13.916Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":14,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Meshblu HTTP Streaming Hostname change\",\n  \"body\": \"Due to some limitations of streaming chunked data, and keeping long-lived idle connections, to the client, we have set up a dedicated host for streaming Meshblu messages over http.\\n\\n`https://meshblu-http-streaming.octoblu.com`\\n\\nWe will permanently redirect all requests sent to `https://meshblu.octoblu.com/subscribe*` to the new host.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"/subscribe\"\n}\n[/block]\nThis is a streaming API that returns device/node messages as they are sent and received. Meshblu doesn't close the stream. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"devices\\\":\\\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\\\",\\n  \\\"payload\\\":\\n  {\\n    \\\"red\\\":\\\"on\\\"\\n  }\\n}\\n{\\n  \\\"devices\\\":\\\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\\\",\\n  \\\"payload\\\":\\n  {\\n    \\\"red\\\":\\\"on\\\"\\n  } \\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Subscribe by type\"\n}\n[/block]\nYou can limit the types of messages you subscribe to by using the `types` parameter.\n\nValid types include:\n* `broadcast` - broadcast messages sent by the device\n* `received` - messages received by the device\n* `sent` - messages sent by the device \n\nDefault is all types.\n\nSpecify multiple `types` options in your url to subscribe to multiple types.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe?types=sent&types=received --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Filter by topic\"\n}\n[/block]\nYou can limit the topics of the messages you are subscribed to by using the `topics` parameter.\n\nTopics support:\n* string: e.g. `device-status`\n* wildcard: e.g. `*device*`\n\nYou may also omit topics by prepending a `-` on the topic you wish to skip. e.g. `-device-status`\n\nSpecify multiple `topics` options in your url to filter (or omit) multiple topics.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe?topics=device*&topics=-*-status* --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"/subscribe/{uuid}\"\n}\n[/block]\nThis is a streaming API that returns device/node messages as they are sent and received. Meshblu doesn't close the stream. This will stream messages from the uuid you've specified. \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Permissions\",\n  \"body\": \"The uuid/token you're authenticating with must have permissions to view messages from the subscribed uuid, either as the owner or in the receiveWhitelist. You may also use the token as a query parameter.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nSubscribe with token\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b?token=0a17660ff1a8d374f1a9ba17cb1b2aac4bbb25ea\\n --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"fromUUid\\\":\\\"ad698900-2546-11e3-87fb-c560cb0ca47b\\\",\\n  \\\"devices\\\":\\\"*\\\",\\n  \\\"payload\\\":\\n  {\\n    \\\"red\\\":\\\"on\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"/subscribe/{uuid}/broadcast\"\n}\n[/block]\nSubscribe to only broadcast messages sent by the subscribed device.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/broadcast --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"fromUUid\\\":\\\"ad698900-2546-11e3-87fb-c560cb0ca47b\\\",\\n  \\\"devices\\\":\\\"*\\\",\\n  \\\"payload\\\":\\n  {\\n    \\\"red\\\":\\\"on\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"/subscribe/{uuid}/received\"\n}\n[/block]\nSubscribe to only messages received by the subscribed device.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/received --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"fromUUid\\\":\\\"ad698900-2546-11e3-87fb-c560cb0ca47b\\\",\\n  \\\"devices\\\":\\\"ad698900-2546-11e3-87fb-c560cb0ca47b\\\",\\n  \\\"payload\\\":\\n  {\\n    \\\"red\\\":\\\"on\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"/subscribe/{uuid}/sent\"\n}\n[/block]\nSubscribe to messages sent by the subscribed device.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/sent --header \\\"meshblu_auth_uuid: {my uuid}\\\" --header \\\"meshblu_auth_token: {my token}\\\"\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"fromUUid\\\": \\\"ad698900-2546-11e3-87fb-c560cb0ca47b\\\",\\n  \\\"devices\\\": [\\\"ddd98900-2546-11e3-87fb-c560cb0ca47b\\\"],\\n  \\\"payload\\\":\\n  {\\n    \\\"red\\\":\\\"on\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"subscribe","type":"basic","title":"Subscribe"}
[block:callout] { "type": "warning", "title": "Meshblu HTTP Streaming Hostname change", "body": "Due to some limitations of streaming chunked data, and keeping long-lived idle connections, to the client, we have set up a dedicated host for streaming Meshblu messages over http.\n\n`https://meshblu-http-streaming.octoblu.com`\n\nWe will permanently redirect all requests sent to `https://meshblu.octoblu.com/subscribe*` to the new host." } [/block] [block:api-header] { "type": "get", "title": "/subscribe" } [/block] This is a streaming API that returns device/node messages as they are sent and received. Meshblu doesn't close the stream. [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"devices\":\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\",\n \"payload\":\n {\n \"red\":\"on\"\n }\n}\n{\n \"devices\":\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\",\n \"payload\":\n {\n \"red\":\"on\"\n } \n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Subscribe by type" } [/block] You can limit the types of messages you subscribe to by using the `types` parameter. Valid types include: * `broadcast` - broadcast messages sent by the device * `received` - messages received by the device * `sent` - messages sent by the device Default is all types. Specify multiple `types` options in your url to subscribe to multiple types. [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe?types=sent&types=received --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "curl" } ] } [/block] [block:api-header] { "type": "basic", "title": "Filter by topic" } [/block] You can limit the topics of the messages you are subscribed to by using the `topics` parameter. Topics support: * string: e.g. `device-status` * wildcard: e.g. `*device*` You may also omit topics by prepending a `-` on the topic you wish to skip. e.g. `-device-status` Specify multiple `topics` options in your url to filter (or omit) multiple topics. [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe?topics=device*&topics=-*-status* --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "curl" } ] } [/block] [block:api-header] { "type": "get", "title": "/subscribe/{uuid}" } [/block] This is a streaming API that returns device/node messages as they are sent and received. Meshblu doesn't close the stream. This will stream messages from the uuid you've specified. [block:callout] { "type": "warning", "title": "Permissions", "body": "The uuid/token you're authenticating with must have permissions to view messages from the subscribed uuid, either as the owner or in the receiveWhitelist. You may also use the token as a query parameter." } [/block] [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "shell" } ] } [/block] Subscribe with token [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b?token=0a17660ff1a8d374f1a9ba17cb1b2aac4bbb25ea\n --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"fromUUid\":\"ad698900-2546-11e3-87fb-c560cb0ca47b\",\n \"devices\":\"*\",\n \"payload\":\n {\n \"red\":\"on\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "/subscribe/{uuid}/broadcast" } [/block] Subscribe to only broadcast messages sent by the subscribed device. [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/broadcast --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "shell" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"fromUUid\":\"ad698900-2546-11e3-87fb-c560cb0ca47b\",\n \"devices\":\"*\",\n \"payload\":\n {\n \"red\":\"on\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "/subscribe/{uuid}/received" } [/block] Subscribe to only messages received by the subscribed device. [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/received --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "shell" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"fromUUid\":\"ad698900-2546-11e3-87fb-c560cb0ca47b\",\n \"devices\":\"ad698900-2546-11e3-87fb-c560cb0ca47b\",\n \"payload\":\n {\n \"red\":\"on\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "/subscribe/{uuid}/sent" } [/block] Subscribe to messages sent by the subscribed device. [block:code] { "codes": [ { "code": "curl -L -X GET https://meshblu.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/sent --header \"meshblu_auth_uuid: {my uuid}\" --header \"meshblu_auth_token: {my token}\"", "language": "shell" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"fromUUid\": \"ad698900-2546-11e3-87fb-c560cb0ca47b\",\n \"devices\": [\"ddd98900-2546-11e3-87fb-c560cb0ca47b\"],\n \"payload\":\n {\n \"red\":\"on\"\n }\n}", "language": "json" } ] } [/block]