Receivers

Receive data from telematic sensors and IoT Devices


Pegasus has a way to receive telematics data from various server endpoints or receivers. You can send data with simple location information or rich data with engine or accessory related info. Once the data is received in Pegasus you are able to use the API & visualize it in the Pegasus Application


Data Receiver for Vehicles

Send data that is associated to a primary entity type (usually vehicles).


Intro

In order to start receiving data from third party devices via an HTTP POST, you'll need to:

  • Step 1: Activate the JSON receiver for your Pegasus Gateway
  • Step 2: Add the device IMEI that you'll be sending data from to the API
  • Step 3: Create a receiver token

For the first 2 steps you can contact your account representative.





Receive for an asset

Authentication


Create an asset (POST /assets)

{
  "first_name": "name of asset",
  "type": "tracking_device"
}

Create and associate a device (PUT /assets/3315)

{
  "tracker_mode": true
}

This will generate a unique token for that particular asset that we can use to POST data to. Example token: UTNZEHBL

{
  ...
  "tracker": {
    "asset_id": 3315,
    "site_id": 1,
    "site_url": "cloud.pegasusgateway.com",
    "active": true,
    "token": "UTNZEHBL",
    "device": 450000141115142
  },
  ...
}

To prepare the asset to receive data we have to assign the device associated to this asset a configuration. This can be done with POST /device-config/:imei sending a key ky with the value s000


Setting the configuration to the device (POST /device-config/450000141115142)

{
  "ky": "s000"
}

200 OK

{
  "kydef": {},
  "kymod": {},
  "total_count": 19,
  "_config_state": 1,
  "_epoch": 1553253405.348958,
  "ky": "s000",
  "devconfig_id": 9188,
  "pending": true
}

Upload data

In order to publish telemetry data to Pegasus server, send POST request to the following URL:
https://api.pegasusgateway.com/assets/event?tracker=:token

replacing :token with the token generated previously.


Send data to tracker (POST https://api.pegasusgateway.com/assets/event?tracker=UTNZEHBL)

note that the POST is always made to 'api.pegasusgateway.com'

using server time

{
  "latitude": 20.993852,
  "longitude": -89.710796,
  "mph": 10,
  "heading": 342,
  "altitude": 10,
  "label": "ignon",
  "use_server_time": true
}

200 OK

{
  "message": "event processed successfully"
}

using an epoch

{
  "latitude": 21.993852,
  "longitude": -90.710796,
  "mph": 99,
  "heading": 193,
  "altitude": 200,
  "label": "ignoff",
  "use_server_time": false,
  "epoch": 1553187370
}

The only keys the upload API is accepting at the moment are:

paramtypedescription
latitudenumberWGS84 latitude
longitudenumberWGS84 longitude
mphnumberspeed in mph
headingnumberheading in degrees 0-359 0=north, 90=east, etc.
altitudenumberdevice altitude in meters
[label]stringevent label (if not specified a trckpnt is automatically assigned) see list of labels
use_server_timebooleantrue to use a server timestamp for the incoming data

Please note that if the use_server_time is not set, the server-side timestamp will be assigned to uploaded data!

In case your device is able to get the client-side timestamp, you can use following format:

{"epoch":1532452713}

In the example above, we assume that “1532452713” is a unix timestamp with seconds precision. ‘1532452713’ corresponds to ‘Tuesday, July 24, 2018 5:18:33 PM GMT’