property.summary
The property.summary command is used to obtain summary data for a set of properties over a time period.
For more information about properties see Defining Properties.
Property summary information can be requested by specifying the following:
-
A definite time period using a start and end date
-
A time period defined by the last period of time style query (for example, last 24h)
TR50 Request
// Definite time period request
{
"cmd": {
"command": "property.summary",
"params": {
"thingKey": "mything",
"keys": ["myprop"],
"start": "2014-01-01T00:00:00Z",
"end": "2014-01-31T23:59:59Z"
}
}
}
// Last period of time request
{
"cmd": {
"command": "property.summary",
"params": {
"thingKey": "mything",
"keys": ["myprop"],
"last": "24h"
}
}
}
Request Parameters
Name |
Type |
Required |
Description |
---|---|---|---|
|
Thing Identifier Parameters |
|
Identifies the thing to which the property data is to be associated. If omitted, the thingKey associated with your session will be used. See Thing Identifier Parameters table below for supported parameters. |
keys |
String Array |
Yes |
The keys for the properties that you wish to summarize, input must be an array even if only a single property is being queried. |
start |
String |
|
When doing a definite time period request this is the timestamp for the start of the specified time window. |
end |
String |
|
When doing a definite time period request this is the timestamp for the end of the specified time window. |
last |
String |
|
When doing a last period of time request this specifies the last X amount of time in nanoseconds (ns), microseconds (us), milliseconds (ms), seconds (s), minutes (m) or hours (h). |
Thing Identifier Parameters
Name |
Type |
Description |
---|---|---|
thingKey |
String |
Key of the thing |
thingId |
String |
Id of the thing |
esn |
String |
Esn of the thing |
iccid |
String |
Iccid of the thing |
imei |
String |
Imei of the thing |
imsi |
String |
Imsi of the thing |
meid |
String |
Meid of the thing |
msisdn |
String |
Msisdn of the thing |
TR50 Response
If the command is sent successfully a success message and the property values found are returned. Otherwise, an error and error message will be returned.
The number of records returned is limited by Device Cloud. In cases where your selection has more results than the limit of Device Cloud, you should shorten your time window or lower the number of records you are requesting.
{
"cmd": {
"success": true,
"params": {
"data": {
"myprop": {
"sum": 10000,
"count": 20,
"avg": 500,
"max":1000,
"min":10
}
}
}
}
}
Response Parameters
The property.summary response includes a data element that has an object for each property.
Data objects have the following parameters:
Name |
Type |
Description |
---|---|---|
sum |
Float |
The sum of all values in the query range. |
count |
Float |
The number of data records in the query range. |
avg |
Float |
The average (sum/count) of data records in the query range. |
max |
Float |
The maximum value within the query range. |
min |
Float |
The minimum value within the query range. |