Sending Data
When making a request to the TagoIO API, you must also specify the appropriate regional endpoint. Check out the available regions here: API documentation
:::tip Looking for a lighter protocol? TagoTiP lets you send the same data in ~130 bytes instead of ~487 - no JSON, no HTTP headers. Ideal for constrained devices. See TagoTiP over HTTP for the HTTP transport. :::
A device can send data to TagoIO by using the POST method.
POST https://api.<region>.tago.io/data
Request fields
| Key | Type | Required |
|---|---|---|
| variable | string (max 100 characters) | yes |
| unit | string (max 25 characters) | no |
| value | string / number / boolean (max 6kB) | no |
| time | string | no |
| group | string (max 100 characters) | no / auto |
| location | object | geoJSON | no |
| metadata | object (max 10kB) | no |
You must include a Device-Token to authorize the operation. Learn more about the fields necessary to send data to TagoIO, including the Header and other formats: fields necessary.
Location field
The location field accepts two formats:
GeoJSON Point:
{ "type": "Point", "coordinates": [-85.628292, 42.2974279] }
LatLng literal:
{ "lat": 42.2974279, "lng": -85.628292 }
Both are valid at ingestion time. TagoIO normalizes all location data to GeoJSON before storing it, so what you read back will always be { "type": "Point", "coordinates": [...] }.
GeoJSON uses [longitude, latitude] order, not the common lat/lng convention. Double-check your coordinate order when using the GeoJSON format.
Notes and restrictions
-
Variables are always converted to lowercase.
-
Variable names may not include special characters such as
*?!<>.-=$or spaces. -
You can send multiple registers in a single POST by sending an array of objects. The maximum payload size is 200 kB (approximately 8,000 registers).
-
Metadata can be attached to variables to influence widget behavior and store additional information. For example:
{"variable": "temperature","unit": "F","value": 55,"metadata": { "color": "red", "icon": "car" },"location": { "lat": 42.2974279, "lng": -85.628292 }}When displayed in a table, the row will be red; when displayed on a map widget, the pin will be red with a car icon.
-
Rate limits apply to API requests. Read more about them here: Rate Limits.
-
For testing, try our Device Emulator to post data and learn the JSON structure: Device Emulator.
Example payload:
{
"variable": "temperature",
"unit": "F",
"value": 55,
"time": "2015-11-03 13:44:33",
"location": { "lat": 42.2974279, "lng": -85.628292 }
}