{"_id":"55674d7a77c15523002fd5b4","category":{"_id":"55674b187acd550d0075eb14","pages":["55674b197acd550d0075eb16","55674c1d77c15523002fd5a3","55674c2d7acd550d0075eb1d","55674c9a77c15523002fd5a9","55674ce31c38390d006980c7","55674d1d7acd550d0075eb22","55674d7a77c15523002fd5b4","55674dac77c15523002fd5b6","55674e4c77c15523002fd5bb"],"__v":9,"project":"55674b177acd550d0075eb10","version":"55674b187acd550d0075eb13","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-28T17:06:32.570Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"__v":3,"version":{"_id":"55674b187acd550d0075eb13","__v":1,"project":"55674b177acd550d0075eb10","createdAt":"2015-05-28T17:06:32.083Z","releaseDate":"2015-05-28T17:06:32.083Z","categories":["55674b187acd550d0075eb14"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"5564f227f0f70f0d00a9ab20","project":"55674b177acd550d0075eb10","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-28T17:16:42.889Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":7,"body":"[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. Notice the comma at the end of the response. Meshblu doesn't close the stream. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"coap get -H \\\"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\\\" coap://meshblu-coap.octoblu.com/subscribe -o\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\\"devices\\\":\\\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\\\",\\\"message\\\":{\\\"red\\\":\\\"on\\\"},\\\"timestamp\\\":1388768270795,\\\"eventCode\\\":300,\\\"_id\\\":\\\"52c6ec0e4f67671e44000001\\\"},{\\\"devices\\\":\\\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\\\",\\\"message\\\":{\\\"red\\\":\\\"on\\\"},\\\"timestamp\\\":1388768277473,\\\"eventCode\\\":300,\\\"_id\\\":\\\"52c6ec154f67671e44000002\\\"},\",\n      \"language\": \"json\"\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 broadcasts messages as they are sent. Notice the comma at the end of the response. Meshblu doesn't close the stream. This will stream broadcast messages from the uuid you've specified. The uuid/token you're authenticating with must have permissions to view messages from the subscribed uuid. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"coap get -H \\\"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\\\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b -o\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\\"devices\\\":\\\"*\\\",\\\"fromUuid\\\":\\\"ad698900-2546-11e3-87fb-c560cb0ca47b\\\",\\\"message\\\":{\\\"red\\\":\\\"on\\\"},\\\"timestamp\\\":1388768270795,\\\"eventCode\\\":300,\\\"_id\\\":\\\"52c6ec0e4f67671e44000001\\\"},{\\\"devices\\\":\\\"*\\\",\\\"fromUuid\\\":\\\"ad698900-2546-11e3-87fb-c560cb0ca47b\\\",\\\"message\\\":{\\\"red\\\":\\\"on\\\"},\\\"timestamp\\\":1388768277473,\\\"eventCode\\\":300,\\\"_id\\\":\\\"52c6ec154f67671e44000002\\\"},\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\"\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\": \"coap get -H \\\"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\\\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/broadcast -o\",\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\": \"coap get -H \\\"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\\\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/received -o\",\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\": \"coap get -H \\\"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\\\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/sent -o\",\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:api-header] { "type": "get", "title": "/subscribe" } [/block] This is a streaming API that returns device/node messages as they are sent and received. Notice the comma at the end of the response. Meshblu doesn't close the stream. [block:code] { "codes": [ { "code": "coap get -H \"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\" coap://meshblu-coap.octoblu.com/subscribe -o", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\"devices\":\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\",\"message\":{\"red\":\"on\"},\"timestamp\":1388768270795,\"eventCode\":300,\"_id\":\"52c6ec0e4f67671e44000001\"},{\"devices\":\"0d3a53a0-2a0b-11e3-b09c-ff4de847b2cc\",\"message\":{\"red\":\"on\"},\"timestamp\":1388768277473,\"eventCode\":300,\"_id\":\"52c6ec154f67671e44000002\"},", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "/subscribe/{uuid}" } [/block] This is a streaming API that returns device/node broadcasts messages as they are sent. Notice the comma at the end of the response. Meshblu doesn't close the stream. This will stream broadcast messages from the uuid you've specified. The uuid/token you're authenticating with must have permissions to view messages from the subscribed uuid. [block:code] { "codes": [ { "code": "coap get -H \"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b -o", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\"devices\":\"*\",\"fromUuid\":\"ad698900-2546-11e3-87fb-c560cb0ca47b\",\"message\":{\"red\":\"on\"},\"timestamp\":1388768270795,\"eventCode\":300,\"_id\":\"52c6ec0e4f67671e44000001\"},{\"devices\":\"*\",\"fromUuid\":\"ad698900-2546-11e3-87fb-c560cb0ca47b\",\"message\":{\"red\":\"on\"},\"timestamp\":1388768277473,\"eventCode\":300,\"_id\":\"52c6ec154f67671e44000002\"},", "language": "json" } ] } [/block] [block:api-header] { "type": "basic" } [/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": "coap get -H \"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/broadcast -o", "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": "coap get -H \"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/received -o", "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": "coap get -H \"meshblu_auth_uuid={:UUID}&meshblu_auth_token={:TOKEN}\" coap://meshblu-coap.octoblu.com/subscribe/ad698900-2546-11e3-87fb-c560cb0ca47b/sent -o", "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]