{"_id":"57fcc4870312b20e00ac64fc","project":"5435687035740020002a1c04","parentDoc":null,"user":"5435682035740020002a1c01","version":{"_id":"57fcc4860312b20e00ac64c0","project":"5435687035740020002a1c04","__v":1,"createdAt":"2016-10-11T10:52:54.637Z","releaseDate":"2016-10-11T10:52:54.637Z","categories":["57fcc4860312b20e00ac64c1","57fcc4860312b20e00ac64c2","57fcc4860312b20e00ac64c3","57fcc4860312b20e00ac64c4","57fcc4860312b20e00ac64c5","57fcc4860312b20e00ac64c6","57fcc4860312b20e00ac64c7","57fcc4860312b20e00ac64c8","57fcc4860312b20e00ac64c9","57fcc4860312b20e00ac64ca","57fcc4860312b20e00ac64cb"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"[APP-1265], [APP-1035]","version_clean":"5.2.0","version":"5.2"},"__v":0,"category":{"_id":"57fcc4860312b20e00ac64c9","__v":0,"version":"57fcc4860312b20e00ac64c0","project":"5435687035740020002a1c04","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-05-01T21:33:28.863Z","from_sync":false,"order":8,"slug":"integration-examples","title":"Integration Examples"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-05-01T21:37:14.759Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Consider the Agent\",\n  \"body\": \"The Telemetry Agent adds a lot of convenience functions that takes care of the routine tasks of integrating your data and generating streaming metrics from it.\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/oydyMUsBSSgOIyb3Vfzg_methods.png\",\n        \"methods.png\",\n        \"1122\",\n        \"283\",\n        \"#698648\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou're not required to use the Agent to send metrics to TelemetryTV.   While the agent provides a lot of convenient​ tools for integration, there are possible use cases where it may not make sense for you.   If you don't want to use the Telemetry agent you'll need to write code to do the integration with TelemetryTV's API, in effect writing your own agent.  You should assess your particular requirements to determine whether this is appropriate. \n\n# API Formats\n\nTelemetryTV has a [REST](http://en.wikipedia.org/wiki/Representational_state_transfer) API that uses the [JSON](http://en.wikipedia.org/wiki/JSON) data format.   \n\nYou must write your API interaction code to handle JSON data and use JSON encoding for submitted data.\n\n\n\n# Authentication\n\nYou must send your API Token as the user in HTTP Basic authentication.  Send a blank password as part of the HTTP Authentication.\n\n# Simple CURL Examples\n\nUsing the [CURL](http://en.wikipedia.org/wiki/CURL) command line tool you can send data to Telemetry. \n\nFor example, to get a listing of the boards in your account (replace \"abc123abc123\" with your API token):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl https://abc123abc123::::at:::api.telemetrytv.com/boards\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\nAnother example with sending a notification:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST --user 'abc123abc123:' https://api.telemetrytv.com/channels/xyz789zyz789/notifications -H 'Content-Type: application/json' --data '{\\\"title\\\":\\\"Warning\\\",\\\"message\\\":\\\"CPU Usage is over 9000!\\\"}'\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]\n# Sending Metrics to the API\n\nPlease consult our API Documentation to send Metrics to Telemetry.   \n\nYou should look at the [Metrics](doc:metrics) API Methods for details on the method parameters to use in order to send data.  We suggest using the batch methods to send bundles of flows metric updates at once so as to reduce latency, data transmission times and API calls.\n\nPlease see the [Direct Integration Example](doc:using-the-api-directly) for a sample of how to directly integrate with the Telemetry API.","excerpt":"","slug":"using-the-api-directly","type":"basic","title":"Using the API Directly"}

Using the API Directly


[block:callout] { "type": "info", "title": "Consider the Agent", "body": "The Telemetry Agent adds a lot of convenience functions that takes care of the routine tasks of integrating your data and generating streaming metrics from it." } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/oydyMUsBSSgOIyb3Vfzg_methods.png", "methods.png", "1122", "283", "#698648", "" ] } ] } [/block] You're not required to use the Agent to send metrics to TelemetryTV. While the agent provides a lot of convenient​ tools for integration, there are possible use cases where it may not make sense for you. If you don't want to use the Telemetry agent you'll need to write code to do the integration with TelemetryTV's API, in effect writing your own agent. You should assess your particular requirements to determine whether this is appropriate. # API Formats TelemetryTV has a [REST](http://en.wikipedia.org/wiki/Representational_state_transfer) API that uses the [JSON](http://en.wikipedia.org/wiki/JSON) data format. You must write your API interaction code to handle JSON data and use JSON encoding for submitted data. # Authentication You must send your API Token as the user in HTTP Basic authentication. Send a blank password as part of the HTTP Authentication. # Simple CURL Examples Using the [CURL](http://en.wikipedia.org/wiki/CURL) command line tool you can send data to Telemetry. For example, to get a listing of the boards in your account (replace "abc123abc123" with your API token): [block:code] { "codes": [ { "code": "curl https://abc123abc123:@api.telemetrytv.com/boards", "language": "curl" } ] } [/block] Another example with sending a notification: [block:code] { "codes": [ { "code": "curl -X POST --user 'abc123abc123:' https://api.telemetrytv.com/channels/xyz789zyz789/notifications -H 'Content-Type: application/json' --data '{\"title\":\"Warning\",\"message\":\"CPU Usage is over 9000!\"}'", "language": "curl" } ] } [/block] # Sending Metrics to the API Please consult our API Documentation to send Metrics to Telemetry. You should look at the [Metrics](doc:metrics) API Methods for details on the method parameters to use in order to send data. We suggest using the batch methods to send bundles of flows metric updates at once so as to reduce latency, data transmission times and API calls. Please see the [Direct Integration Example](doc:using-the-api-directly) for a sample of how to directly integrate with the Telemetry API.