{"_id":"56c41cb670187b17005f43bd","project":"56bc8e679afb8b0d00d62dcf","category":{"_id":"56c4183328bd680d005e7ac6","pages":["56c41c94106c12170020dba2","56c41ca22d97560d00e23cfd","56c41cad4f0aed1700afabaa","56c41cb670187b17005f43bd"],"project":"56bc8e679afb8b0d00d62dcf","__v":4,"version":"56bc8e689afb8b0d00d62dd2","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-02-17T06:50:27.750Z","from_sync":false,"order":1,"slug":"iot-telemetry","title":"IoT Telemetry"},"version":{"_id":"56bc8e689afb8b0d00d62dd2","project":"56bc8e679afb8b0d00d62dcf","__v":18,"createdAt":"2016-02-11T13:36:40.146Z","releaseDate":"2016-02-11T13:36:40.146Z","categories":["56bc8e689afb8b0d00d62dd3","56c3c837bc41330d009f25ed","56c3c83e521f350d00d348eb","56c3c8452d97560d00e23cd8","56c3c85234df460d00c2beb8","56c4180d70187b17005f43b4","56c418162d97560d00e23cf6","56c4181cc4796b0d007ef039","56c4182370187b17005f43b5","56c418292e75e01700986052","56c4183328bd680d005e7ac6","56c4183bbb64720d00552b88","56c418414040602b0064cea0","56c4184754b6030d00ec29a1","56c4184c28bd680d005e7ac7","56c4185370187b17005f43b6","56c4185b6063071700500cfc","582a98b6f8c0a0190053d7a5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"user":"56b98db7bb36440d0001f492","__v":6,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-17T07:09:42.524Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"/telemetry/{name}\"\n}\n[/block]\nMake sure you've read the [Telemetry Overview](doc:telemetry-overview)!\n\nAdd telemetry data to Buddy, to the specified configuration referenced by `name`.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Be sure to use the 'post' method to send telemetry data.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var options = {\\n\\tdata: {value_a:1, value_b:true},\\n\\ttimestamp: \\\"1415578208000\\\",\\n\\tlocation: \\\"47.1, -121.292\\\"\\n};\\n\\nBuddy.post('/telemetry/my_name',\\n\\t\\toptions,\\n\\t\\tfunction(err, result) {\\n\\t\\t\\t \\n\\t\\t\\tif (result.success) {\\n\\t\\t\\t\\t// Do something with the result!\\n\\t\\t\\t} else { \\n\\t\\t\\t\\t// Otherwise log the error\\n\\t\\t\\t\\tconsole.log(err); \\n\\t\\t\\t} \\n\\t\\t}\\n\\t);\",\n      \"language\": \"javascript\"\n    },\n    {\n      \"code\": \"NSDictionary *params = :::at:::{\\n\\t\\t\\[email protected]\\\"data\\\": [[NSDictionary alloc] initWithObjectsAndKeys:@\\\"value1\\\", @\\\"key1\\\", @\\\"value2\\\", @\\\"key2\\\", nil],\\n\\t\\t\\[email protected]\\\"timestamp\\\": @\\\"1415578208000\\\",\\n\\t\\t\\[email protected]\\\"location\\\": BPCoordinateMake(47.1, -121.292)\\n\\t\\t};\\n\\n[Buddy POST:@\\\"/telemetry/my_name\\\" parameters:params class:[NSDictionary class] callback:^(id obj, NSError *error) {\\n\\t// Your callback code here\\n}];\",\n      \"language\": \"objectivec\",\n      \"name\": \"iOS\"\n    },\n    {\n      \"code\": \"Map<String, Object> parameters = new HashMap<String, Object>();\\nparameters.put(\\\"data\\\", myAndroidHashmap);\\nparameters.put(\\\"timestamp\\\", \\\"1415578208000\\\");\\nparameters.put(\\\"location\\\", myLocation);\\n\\nBuddy.<JsonObject>post(\\\"/telemetry/my_name\\\", parameters, new BuddyCallback<JsonObject>(JsonObject.class) {\\n\\[email protected]\\n\\tpublic void completed(BuddyResult<JsonObject> result) {\\n\\t\\t// Your callback code here\\n\\t}\\n});\",\n      \"language\": \"java\",\n      \"name\": \"Android\"\n    },\n    {\n      \"code\": \"var options = new {\\n\\t\\t\\tdata = new {foo = 1, bar = true},\\n\\t\\t\\ttimestamp = \\\"1415578208000\\\",\\n\\t\\t\\tlocation = new BuddyGeoLocation(47.1, -122.3)\\n\\t\\t};\\n\\nvar result = await Buddy.PostAsync<bool>(\\\"/telemetry/my_name\\\", options);\",\n      \"language\": \"csharp\",\n      \"name\": \".NET\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n###Path Parameters\n\nThese parameters should be specified as part of the HTTP path.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"name\",\n    \"0-1\": \"The name of an existing telemetry configuration.\",\n    \"0-2\": \"string\",\n    \"0-3\": \"Required\"\n  },\n  \"cols\": 4,\n  \"rows\": 1\n}\n[/block]\n###Body Parameters\n\nThese parameters should be specified as part of the request body.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"data\",\n    \"1-0\": \"timestamp\",\n    \"2-0\": \"location\",\n    \"0-1\": \"A JSON object representing the data to send to Buddy Telemetry.\",\n    \"1-1\": \"Time other than current to set as created time.\",\n    \"2-1\": \"A location value, passed as a string in the format \\\"{latitude},{longitude}\\\" (e.g. \\\"47.1,-121.292\\\").\",\n    \"0-2\": \"object\",\n    \"1-2\": \"date\",\n    \"2-2\": \"string\",\n    \"0-3\": \"Optional\",\n    \"1-3\": \"Optional\",\n    \"2-3\": \"Optional\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"status\\\": 200,\\n  \\\"request_id\\\": \\\"5391f834b32fad187c1fc0f8\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","excerpt":"","slug":"add-telemetry-data","type":"basic","title":"Add Telemetry Data"}

Add Telemetry Data


[block:api-header] { "type": "post", "title": "/telemetry/{name}" } [/block] Make sure you've read the [Telemetry Overview](doc:telemetry-overview)! Add telemetry data to Buddy, to the specified configuration referenced by `name`. [block:callout] { "type": "info", "body": "Be sure to use the 'post' method to send telemetry data." } [/block] [block:code] { "codes": [ { "code": "var options = {\n\tdata: {value_a:1, value_b:true},\n\ttimestamp: \"1415578208000\",\n\tlocation: \"47.1, -121.292\"\n};\n\nBuddy.post('/telemetry/my_name',\n\t\toptions,\n\t\tfunction(err, result) {\n\t\t\t \n\t\t\tif (result.success) {\n\t\t\t\t// Do something with the result!\n\t\t\t} else { \n\t\t\t\t// Otherwise log the error\n\t\t\t\tconsole.log(err); \n\t\t\t} \n\t\t}\n\t);", "language": "javascript" }, { "code": "NSDictionary *params = @{\n\t\t\[email protected]\"data\": [[NSDictionary alloc] initWithObjectsAndKeys:@\"value1\", @\"key1\", @\"value2\", @\"key2\", nil],\n\t\t\[email protected]\"timestamp\": @\"1415578208000\",\n\t\t\[email protected]\"location\": BPCoordinateMake(47.1, -121.292)\n\t\t};\n\n[Buddy POST:@\"/telemetry/my_name\" parameters:params class:[NSDictionary class] callback:^(id obj, NSError *error) {\n\t// Your callback code here\n}];", "language": "objectivec", "name": "iOS" }, { "code": "Map<String, Object> parameters = new HashMap<String, Object>();\nparameters.put(\"data\", myAndroidHashmap);\nparameters.put(\"timestamp\", \"1415578208000\");\nparameters.put(\"location\", myLocation);\n\nBuddy.<JsonObject>post(\"/telemetry/my_name\", parameters, new BuddyCallback<JsonObject>(JsonObject.class) {\n\[email protected]\n\tpublic void completed(BuddyResult<JsonObject> result) {\n\t\t// Your callback code here\n\t}\n});", "language": "java", "name": "Android" }, { "code": "var options = new {\n\t\t\tdata = new {foo = 1, bar = true},\n\t\t\ttimestamp = \"1415578208000\",\n\t\t\tlocation = new BuddyGeoLocation(47.1, -122.3)\n\t\t};\n\nvar result = await Buddy.PostAsync<bool>(\"/telemetry/my_name\", options);", "language": "csharp", "name": ".NET" } ], "sidebar": true } [/block] ###Path Parameters These parameters should be specified as part of the HTTP path. [block:parameters] { "data": { "0-0": "name", "0-1": "The name of an existing telemetry configuration.", "0-2": "string", "0-3": "Required" }, "cols": 4, "rows": 1 } [/block] ###Body Parameters These parameters should be specified as part of the request body. [block:parameters] { "data": { "0-0": "data", "1-0": "timestamp", "2-0": "location", "0-1": "A JSON object representing the data to send to Buddy Telemetry.", "1-1": "Time other than current to set as created time.", "2-1": "A location value, passed as a string in the format \"{latitude},{longitude}\" (e.g. \"47.1,-121.292\").", "0-2": "object", "1-2": "date", "2-2": "string", "0-3": "Optional", "1-3": "Optional", "2-3": "Optional" }, "cols": 4, "rows": 3 } [/block] [block:code] { "codes": [ { "code": "{\n \"status\": 200,\n \"request_id\": \"5391f834b32fad187c1fc0f8\"\n}", "language": "json", "name": "Response" } ], "sidebar": true } [/block]