HEADERS:
Authorization: Your-Device-Token

GET - https://api.tago.io/data

QUERYSTRINGS:

KEY
TYPE
DESCRIPTION
variable
string || array
Get variables
querystringpre-defined by Tago
qtystringMaximum number of data to be returned. 
start_datestringStart date (E.g 1 day or ISO String)
end_datestring
End date (E.g 1 day or ISO String)
detailboolAdd more JSON fields on result
fields

  

Response - Below is the data returned without any parameters. https://api.tago.io/data

{
    "status" : true,
    "result": [
        {
            "id": "547e42847dbf3af122c02582",
            "location": {
                "coordinates": [
                    41.878876,
                    -87.635915
                ],
                "type": "Point"
            },
            "time": "2014-12-02T22:51:48.005Z",
            "variable": "location"
        }, {
            "id": "547e353d7dbf3af122c0257d",
            "time": "2014-12-02T21:55:09.301Z",
            "unit": "%",
            "value": 32,
            "variable": "fuel_level"
        },  {
            "id": "547e41f97dbf3af122c02580",
            "time": "2014-12-02T22:49:29.777Z",
            "unit": "psi",
            "value": 25,
            "variable": "oil_pressure"
        }
    ]
}

Variables

variable - using the parameter variable you define the variable that should be returned with the GET method.

For example, to get data with the variable = temperature, use: https://api.tago.io/data?variable=temperature.

Also, you can use an array to get more variables: https://api.tago.io/data?variable[]=temperature&variable[]=pressure

Query

query - the query parameter returns some predefined functions to help you to obtain certain processed data. Note that you can not use two queries concurrently.

last_item - It will return the last information from the data based in the 'time'.

For example: https://api.tago.io/data?variable=temperature&query=last_item

last_value - It will return the last information from the data based in the 'time'. Only the data containing ‘value’ information will be returned.

For example: https://api.tago.io/data?variable=temperature&query=last_value

last_location - It will return the last information from the data based in the 'time'. Only the data containing ‘location’ information will be returned.

For example: https://api.tago.io/data?variable=temperature&query=last_location

Quantity

qty - Limit the number of results that will be returned from a query. The default value is 15.

For example: https://api.tago.io/data?variable=temperature&qty=99

It will return the last 99 registers from temperature.

Start Date - End Date

start_date - Define the start time for the data search. Only the data containing ‘time’ information newer than start_date will be returned.

end_date - Define the end time for the data search. Only the data containing ‘time’ information older than end_date will be returned.

For example: https://api.tago.io/data?variable=temperature&start_date=2014-12-25&end_date=2014-12-26

It will return the data from the variable temperature between the start_date & end_date. The default it will return the last 15 items from the variable.

If your interval has more than 15 items, you need to add the attribute qty.

For example: https://api.tago.io/data?variable=temperature&start_date=2014-12-25&end_date=2014-12-26&qty=999
Start/End date parameters accept different formats, which include selection based on relative time (e.g. to get data from the last 1 hour). Below are some examples:

DATE FORMATS
“2014-12-25”
“2014-12-25 23:33:22”
“Thu Dec 25 2014 23:33:22 GMT+1300 (NZDT)”
“2014-12-25T23:33:22.000Z”
“1 day”
“1 month”
“1 year”

  • Relative dates will be subtracted or added to the current time.