property.current
The property.current command is used to retrieve the value of a property for a given timestamp. If no timestamp is specified then it outputs the current value. For more information about properties see Understanding properties.
TR50 Request
{
"cmd": {
"command": "property.current",
"params": {
"thingKey": "mything",
"key": "myprop",
"ts": "2018-06-29T19:00:07Z"
}
}
}
Request Parameters
Name | Type | Required | Description |
---|---|---|---|
thingKey | String | Yes* | The thing key. |
thingid | String | Id of the thing | |
esn | String | ESN of the connection. | |
iccid | String | ICCID of the connection. | |
imei | String | IMEI of the connection. | |
imsi | String | IMSI of the connection. | |
meid | String | MEID of the connection. | |
msisdn | String | MSISDN of the connection. | |
*One of the above parameters is required to identify the thing. If omitted, the thingKey associated with your session will be used. | |||
key | String | Yes | The key for the property that you wish to retrieve. |
ts | Timestamp | If specified, property.current will return the value at or immediately preceding the specified timestamp. |
If the command is sent successfully a success message and the property value are returned. Otherwise, an error and error message will be returned.
TR50 Response
{
"cmd": {
"success": true,
"params": {
"value": 7,
"ts": "2018-06-29T18:45:38.748Z",
"corrId":"xyz"
}
}
}
Response Parameters
Name | Type | Description |
---|---|---|
value | Float | The current value for the requested property. |
ts | String | Timestamp of the published value |
corrId | String | The correlation identifier associated with the property. |
C API
// basic API
int tr50_property_current(void *tr50, const char *prop_key, double *value);
// extended API
int tr50_property_current_ex(void *tr50, const char *prop_key, double *value, void* optional_params, void** optional_reply, char** error_msg);
JAVA API
// Synchronous
int current(String thingKey, String propKey, Object response);
// Asynchronous
int current(String thingKey, String propKey, DwOpenReceiveActionListener recv, Object response);
Response Objects: StringReply, DwOpenResponse, DwOpenPropertyCurrent
PHP API
mixed TR50httpWorker::propertyCurrent($thingKey, $key);