Ticatag Platform | Documentation

Ticatag Platform | Documentation

    ›API

    Presentation

    • Introduction
    • Connect
    • Available devices

    API

    • Introduction
    • Devices
    • Sensor data

    Webhooks

    • Introduction
    • Setting up Webhooks
    • Events v1
    • Events v2

    Sensor data

    Events are all the sensor data of IOT devices on Ticatag platform.

    Search events

    A GET request will return all events sorted by timestamp (most recent first)

    Example request

    Search for location, battery and temperature ; limit search to 5 events

    $ curl 'https://api.ticatag.com/v2/events?names=location,battery,temperature&size=5' -i
    
    

    Example response

    HTTP/1.1 200 OK
    Content-Type: application/hal+json;charset=UTF-8
    
    {
        "_embedded": {
            "events": [
                {
                    "name": "location",
                    "timestamp": "2019-12-20T14:39:42.942Z",
                    "device_id": "5ABAE564-1A48-49EE-8B06-6AE1CA16350C",
                    "latitude": 48.7593,
                    "longitude": -3.4611,
                    "formatted_address": "Croas Ru, Rue Louis de Broglie, 22300 Lannion, France"
                },
                {
                    "name": "battery",
                    "timestamp": "2019-12-20T14:39:42.942Z",
                    "device_id": "5ABAE564-1A48-49EE-8B06-6AE1CA16350C",
                    "value": 3620,
                    "unit": "millivolt"
                },
                {
                    "name": "temperature",
                    "timestamp": "2019-12-20T14:39:42.942Z",
                    "device_id": "5ABAE564-1A48-49EE-8B06-6AE1CA16350C",
                    "value": 23.0,
                    "unit": "celsius"
                },
                {
                    "name": "battery",
                    "timestamp": "2019-12-20T00:03:53Z",
                    "device_id": "df638879-7077-4839-a0c6-43861d349731",
                    "value": 3584,
                    "unit": "millivolt"
                },
                {
                    "name": "temperature",
                    "timestamp": "2019-12-19T14:39:46.571Z",
                    "device_id": "5ABAE564-1A48-49EE-8B06-6AE1CA16350C",
                    "value": 23.0,
                    "unit": "celsius"
                }
            ]
        },
        "_links": {
            "first": {
                "href": "https://api.ticatag.com/v2/events/?names=location%2Cbattery%2Ctemperature&page=0&size=5"
            },
            "self": {
                "href": "https://api.ticatag.com/v2/events/?names=location%2Cbattery%2Ctemperature&page=0&size=5"
            },
            "next": {
                "href": "https://api.ticatag.com/v2/events/?names=location%2Cbattery%2Ctemperature&page=1&size=5"
            },
            "last": {
                "href": "https://api.ticatag.com/v2/events/?names=location%2Cbattery%2Ctemperature&page=1474&size=5"
            }
        },
        "page": {
            "size": 5,
            "total_elements": 7372,
            "total_pages": 1475,
            "number": 0
        }
    }
    
    PathTypeDescription
    _embedded.eventsArrayList of events

    Query parameters

    You must use query parameters to refine your search of events or to request extra data in reponse.

    ParameterRequiredDescription
    namesxList of events type to search for ; ex names=location,button,battery ; Values = [location, computed_location, battery, battery_status, button, temperature, humidity, level, geofence_monitoring, tracker_metrics, distance, computed_distance, door, shock, rollover, motion]
    device_idsList of device UUIDs to search for
    start_dateSearch on a specifc date range ; UTC Datetime in ISO 8601 format
    end_dateSearch on a specifc date range ; UTC Datetime in ISO 8601 format
    latitudeGeospatial search
    longitudeGeospatial search
    radiusGeospatial search
    organization_idOrganization UUID to search events in
    includesProperties to include in response :
    - event_id (event ID)

    Create events

    A POST request create events The payload accepts a list of events or single event Returns http status code 201

    Example request

    Add a location

    $ curl --location --request POST 'https://api.ticatag.com/v2/events' \
    --header 'Authorization: Bearer {{TOKEN}}' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "name": "location",
        "device_id": "3CD73DDB-4511-4CC0-98CB-6D6147227C30",
        "timestamp": "2018-07-11T15:07:50.873Z",
        "latitude": "48.81559",
        "longitude": "-3.52907"
    }'
    
    

    Location

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "location" for location data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    latitudexdoubleLocation latitude
    longitudexdoubleLocation longitude
    accuracylongAccuracy (in meters) might be added to location in case we get location from wifi or tdoa - Not present in the payload if null
    formatted_addressStringReverse geocoded address from lat/lng. Not present if no results

    Example

    {
        "name": "location",
        "timestamp": "2019-03-21T14:03:12.759Z",
        "latitude": 48.759,
        "longitude": -3.45983,
        "accuracy": 50,
        "formatted_address": "Moulin de Kergomar, Rue Louis de Broglie, 22300 Lannion, France"
    }
    

    Button press

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "button" for button data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    click_typeStringValues=["click","double_click","hold"] or null if click not specified

    Example

    {
        "name": "button",
        "timestamp": "2019-03-21T14:21:05.619Z",
        "click_type": "double_click"
    }
    

    Temperature

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "temperature" for temperature data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    valuexDoubleTemperature value
    unitxStringTemperature unit ; Values=[celsius,fahrenheit]

    Example

    {
        "name": "temperature",
        "timestamp": "2019-03-21T14:35:03.092Z",
        "value": 19.3,
        "unit": "celsius"
    }
    

    Humidity

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "humidity" for humidity data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    valuexDoubleHumidity value
    unitxStringHumidity unit ; Values=[percent]

    Example

    {
        "name": "humidity",
        "timestamp": "2019-03-21T14:42:16.543Z",
        "value": 75.5,
        "unit": "percent"
    }
    

    Door

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "door" for door data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    statusxStringDoor status ; Values=[open,closed]

    Example

    {
        "name": "door",
        "timestamp": "2019-03-21T14:44:45.382Z",
        "status": "closed"
    }
    

    Shock

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "shock" for shock data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    statusxStringShock status ; Values=[clear,detected]

    Example

    {
        "name": "shock",
        "timestamp": "2019-03-21T14:44:45.382Z",
        "status": "detected"
    }
    

    Rollover

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "rollover" for rollover data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    statusxStringRollover status ; Values=[clear,detected]

    Example

    {
        "name": "rollover",
        "timestamp": "2019-03-21T14:44:45.382Z",
        "status": "detected"
    }
    

    Battery

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "battery" for battery data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    valuexIntegerBattery value
    unitxStringBattery unit ; Values=[percent,millivolt]

    Example

    {
        "name": "battery",
        "timestamp": "2019-03-21T14:45:48.229Z",
        "value": 75,
        "unit": "percent"
    }
    

    Battery status

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "battery_status" for battery data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    statusxStringBattery status ; Values=[good,bad]

    Example

    {
        "name": "battery",
        "timestamp": "2019-03-21T14:50:13.651Z",
        "status": "good"
    }
    

    Motion

    Payload

    AttributeRequiredTypeDescription
    namexStringEquals to "motion" for battery data
    device_idxStringDevice UUID
    timestampxStringUTC Datetime in ISO 8601 format
    statusxStringMotion status ; Values=[still,moving]

    Example

    {
        "name": "motion",
        "timestamp": "2019-03-21T14:50:13.651Z",
        "status": "moving"
    }
    
    ← DevicesIntroduction →
    • Search events
    • Create events
    • Location
      • Payload
      • Example
    • Button press
      • Payload
      • Example
    • Temperature
      • Payload
      • Example
    • Humidity
      • Payload
      • Example
    • Door
      • Payload
      • Example
    • Shock
      • Payload
      • Example
    • Rollover
      • Payload
      • Example
    • Battery
      • Payload
      • Example
    • Battery status
      • Payload
      • Example
    • Motion
      • Payload
      • Example
    Copyright © 2020 Ticatag SAS