Forwarders API

API documentation for forwarders

Parameters

Update

paramtypedescription
dates_formatstringdefault: ISOFORMAT (YYYY-MM-DDTHH:MM:SS+HH:MM), python dateformat compatible
time_zonestringdefault: UTC (recommended), timezone
extra_headersobjectdefault: Content-Type: application/json
include_vinfobooleanif true, sends an object with the entities information
generalobjectupdate the general config (see below)

To update a forwarder, you can use a PUT request on the forwarder ID to update the general configuration.
When sending the request, make sure to use the entire JSON object as the body of the PUT request, with the modifications.

general paramstypedescription
discardbooleandiscards old messages in queue & any new messages
keysarrayuse it to only forward certain keys
keys_allbooleanuse it to forward all keys
keys_includearrayuse it to include keys that are not defined in the base set (has priority over keys)
keys_excludearrayuse it to exclude any keys from the forwarder
stop_sendbooleanwhen true it stops the forwarder and queues events
stop_queuebooleanwhen true it stops queuing events, discarding any new events
labels_inarrayonly allows certain labels to forward data
labels_outarrayexclude the following labels from forwarding data
default_valuesobjectkey and default value, ex: {"ib": "000000000000"}
include_primarybooleanwhen true along with the field primary in keys or keys_include it includes a key called primary which contains the vehicle's information and custom properties
legacy general paramstypedescription
legacybooleanwhen true it sends the lat/lon as whole integers values
protocolstringwhen set to "rpc", it wraps the json array of events in the following envelope {"params":[2,[{EVENT_1},{EVENT_2}]],"method":"pushevents","id":1}
codes_mapjsonobject with key-value pairs, the keys should be the original event_code, the value represents the value to which it will be switched
filter_inarrayonly forwards events from these event codes
filter_outarrayremoves any unwanted event codes from forwarding data

Don't forget to send the entire payload

dates_format

PUT /forwarders/:id

{
    "dates_format": "%Y-%m-%d %H:%M:%S"
}

this gives you dates with: YYYY-MM-DD hh:mm:ss, example: 2018-12-25 23:59:59


time_zone

PUT /forwarders/:id

{
    "time_zone": "America/New_York"
}

keys

PUT /forwarders/:id

{
    "general": {
        "keys": [
            "lat",
            "lon",
            "speed",
            "primary_name",
            "event_time"
        ]
    }
}
[
    {
        "lat": -34.88844,
        "lon": -56.11606,
        "speed": 33,
        "primary_name": "Blue Toyota",
        "event_time": "2018-12-17T14:22:09+00:00",
        "system_time": "2018-12-17T14:51:37.969868+00:00"
    }
]

extra_headers

PUT /forwarders/:id

{
    "extra_headers": {
        "Authorization": "Bearer YWRqZmFsZGpmbGFqc2RmbGFhZGxmam"
    }
}

primary

PUT /forwarders/:id

{
    "include_primary": true,
    "keys_include": [
        "primary"
    ]
}
[
    {
        "vid": 2292,
        "lon": -80.19266,
        "primary": {
            "info": {
                "range_unit": "mile",
                "description": "Sample vehicle",
                "tank_volume": null,
                "color": "Black",
                "make": "Peterbilt",
                "vin": null,
                "license_plate": "ABC123",
                "alias": "foxtrot",
                "range": 400,
                "year": "2020",
                "model": "567",
                "tank_unit": "gallon"
            },
            "associations": [
                {
                    "device": 862831032123456,
                    "time": 1592847039,
                    "id": 86,
                    "association": true,
                    "vehicle": 2292
                }
            ],
            "__updated": 1596475523.951629,
            "associated_at": 1592847871,
            "name": "My special car",
            "primary": 9,
            "__created": 1592607412.826321,
            "images": {
                "photo": false,
                "on_icon": false,
                "idle_icon": false,
                "off_icon": false,
                "icon": false
            },
            "token": null,
            "properties": {
                "custom_properties": "yes",
                "network": "4G",
                "city": "FLORIDA",
                "sensor": "v1.2",
                "ID": "10073367",
                "region": "SOUTH",
                "my_info": {
                    "code": "11223344",
                    "state": "UPDATING"
                },
                "country": "US"
            },
            "groups": [
                6
            ],
            "__version": "5.3.2",
            "device": 862831032123456,
            "configuration": "0000",
            "type": "vehicle",
            "id": 2292
        },
        "label": "new",
        "lat": 26.68205,
        "device_id": 862831032123456
    }
]