Device Data
It is recommended to retrieve data via shipments or webhooks and not from a device whenever possible. Devices have a finite amount of storage, and once the storage on a device is full, newer measurements will begin to overwrite the oldest measurements. Tive will always save your shipment records and webhooks will always be sent to the URL specified when they were created making it easy to look back at historical data.
If you still prefer to retrieve data from a device, below are a few ways to do so.
Device Alerts
To view information about alerts that have been triggered from a device, users should make requests via the Get Device Alerts endpoint.
Alerts are useful to gain insight into what may have had a negative impact to the shipments your device has been associated to, but you don't necessarily need to view the data for every sensor measurement.
To retrieve device specific alerts, you must specify a UTC start date specifying how far back you would like to search for device alerts.
Device Status
The option above is good for providing historical alert data over the lifetime of a device. If you don't necessarily need all of that data, the Retrieve Device Status endpoint can be useful for retrieving the latest sensor measurements from a specific device.
{
"currentLocation": {
"name": "Tive HQ",
"coordinates": {
"latitude": 42.381143,
"longitude": -71.080037
},
"address": {
"street": "56 Roland Street",
"sublocality": "",
"locality": "Charlestown",
"state": "Massachusetts",
"country": "United States",
"postalCode": "02129",
},
"locationMethod": "wifi",
},
"isAttachedToShipment": false,
"shipmentId": null,
"lastUpdatedAt": "2022-01-25T15:02:09",
"temperature": 18.21,
"humidity": 29.6,
"pressure": 0,
"light": 5.99,
"motion": 0,
"acceleration": 0.99,
"batteryPercent": 80,
"estimatedBatteryLifeMinutes": 25000
}
The sensor units in the response are as follows:
Sensor Field | Sensor Unit |
---|---|
temperature | Celsius |
humidity | Percent |
light | Lux |
motion | G |
acceleration | G |
batterPercent | Percent |
estimatedBatteryLifeMinutes | Minutes |
When a field is not available, it will be marked as "null". These "null" do not represent a 0 value (ex: 0.00 Celsius for temperature or 0% humidity)
Webhooks
Please visit the Webhooks section to learn more about how to use Tive webhooks with devices.
Updated about 18 hours ago