POST /devices/fields/{fieldname}/actions/history
Returns the readings of a specified sensor, with the most recent reading first. Sensor readings are stored as events; this request an array of events.
See also:
Search Device Fields
POST https://thingspace.verizon.com/api/cc/v1/devices/fields/{fieldname}/actions/history
You must set the field (sensor) that you want to retrieve in the resource path.
Property Name | Data Type | Description |
---|---|---|
fieldname required |
string | The name of the sensor. |
The request header must contain a current ThingSpace authorization token and a current VZ-M2M session token, and must set the content-type to JSON.
Property Name | Data Type | Description |
---|---|---|
Authorization required |
string | HTTP Authorization request header containing a valid ThingSpace Bearer token. |
VZ-M2M-Token required |
string | A valid session token returned by a Connectivity Management API POST /session/login request using the account’s UWS credentials. |
Content-Type required |
string | Must be application/json . |
The device identifier and the number of results that you want to retrieve.
Property Name | Data Type | Description |
---|---|---|
accountidentifier required |
JSON object | The ID of the authenticating billing account, in the format {"billingaccountid":"1234567890-12345"} . |
resourceidentifier required |
JSON object | A device ID type and value that identifies the device to search. Can be any unique device identifier, such as ICCID, ID, or IMEI. |
$limitnumber optional |
integer | The maximum number of events to include in the response. If the request matches more than this number of events, the response will contain an X-Next value in the header that can be used as the page value in the next request to retrieve the next page of events. |
$page optional |
string | Unique string from the previous response to retrieve either the next page (X-Next value) or the previous page (X-Prev value) of events. |
Retrieve the two most recent temperature values
curl POST https://thingspace.verizon.com/api/cc/v1/devices/fields/temperature/actions/history \
-H 'Authorization: Bearer 021833fbee3e118019f67777e028067f' \
-H 'VZ-M2M-Token: f1ffff45-ed4c-4db0-a98c-a371afe23b6a' \
-H 'Content-Type: application/json' \
-d '{
"accountidentifier": {"billingaccountid":"1223334444-00001"},
"resourceidentifier": {"imei":864508030084997},
"$limitnumber": 2
}'
Status 200
A success response includes an array of all matching events. Each event includes the full event resource definition.
Property Name | Data Type | Description |
---|---|---|
action | string | The action requested in this event; “change” for device configuration changes. |
createdon | string, date-time | The date and time of the change request. |
description | string | Description of the event. |
deviceid | string, UUID | The device’s ThingSpace UUID. |
errmsg | string | |
fields | JSON object | List of fields affected by the event. |
foreignid | string, UUID | |
id | string, UUID | The unique ID of this ts.event.configuration event. |
kind | string | The kind of the ThingSpace resource that is being reported; “ts.event.configuration” for device configuration changes. |
lastupdated | string, date-time | The date and time that the event was last updated. |
name | string | The name of the event; “SetConfigurationReq” for device configuration changes. |
state | string | The current status of the request. The value will be “pending” until the device wakes up and ThingSpace can send the request to the device. |
tagids | array, UUIDs | UUIDs of tag resources that are applied to this device. |
transactionid | string, UUID | |
version | string | |
versionid | string, UUID | The version of the resource. |
[
{
"action": "update",
"createdon": "2019-02-22T04:05:26Z",
"deviceid": "8461f530-2e31-6e87-e357-6c38251d4d01",
"fields": {
"temperature": "18.4"
},
"id": "4521b7a7-7de1-6e68-f020-1345ef3b764a",
"kind": "ts.event",
"lastupdated": "2019-02-22T04:05:49.786Z",
"state": "update",
"tagids": [
"4d110e4f-7a7c-6b26-eaac-31cc34c6e1d4",
"cd81ed16-18ae-6c7d-eaba-2883b0395387"
],
"transactionid": "864508030084997-OnBoard-c05f946c-3f5c-4527-b4d0-5aca256fc3dd",
"version": "1.0",
"versionid": "238addb9-3657-11e9-8848-02420a951f13"
},
{
"action": "update",
"createdon": "2019-02-22T03:05:26Z",
"deviceid": "8461f530-2e31-6e87-e357-6c38251d4d01",
"fields": {
"temperature": "19.0"
},
"id": "05b1ea7b-4bf2-6af6-ea8b-414595f2c3e9",
"kind": "ts.event",
"lastupdated": "2019-02-22T03:05:48.483Z",
"state": "update",
"tagids": [
"4d110e4f-7a7c-6b26-eaac-31cc34c6e1d4",
"cd81ed16-18ae-6c7d-eaba-2883b0395387"
],
"transactionid": "864508030084997-OnBoard-5f71f47d-4464-4f69-a3ee-5c243f0ef5b8",
"version": "1.0",
"versionid": "c0ffa4b5-364e-11e9-a3ee-02420a8c0d14"
}
]
Status 4xx
All error messages are returned in this format:
{
"error": "error code string",
"error_description": "error message string",
"cause": "further explanation"
}
Error codes and messages are listed on the Error Messages page, along with explanations and suggestions for corrective actions.