V2.1 Set Measurement Point¶
Sets the measurement point for the device.
This API is available in EnOS 2.1.0 and above.
This API can execute cached commands or instant commands. When executing instant commands, the API response data is returned after the device returns the measurement point setting results. If the device does not return the results within the specified measurement point setting timeout period, the EnOS service will wait for the timeout and then return the API response data.
When executing cached commands, the data will be returned directly after being cached.
Operation Permissions¶
Before invoking this API, ensure that the service account has been authorized the policy that includes the following service(s) and action permission(s). For how to authorize the service account, see Managing Service Accounts.
Required Service |
Required Operation Permission |
---|---|
Asset |
Control |
Prerequisite¶
The device must be online.
Request Format¶
POST https://{apigw-address}/connect-service/v2.1/commands?action=setMeasurepoint
Request Parameters (URI)¶
Note
Use one of the following methods to specify the device:
Include
assetId
in the requestInclude
productKey
+deviceKey
in the request
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
assetId |
Query |
Optional (See Note above) |
String |
The asset ID. How to get assetId>> |
productKey |
Query |
Optional (See Note above) |
String |
The product key. To be used with |
deviceKey |
Query |
Optional (See Note above) |
String |
The device key. To be used with |
measurepointId |
Query |
Mandatory |
String |
The measurement point ID. How to get pointId>> |
pendingTtl |
Query |
Optional |
Integer |
The cache storage time. Its unit is seconds and its range is [0 - 172800 (i.e. 48 hours)], which is 0 by default. If |
timeout |
Query |
Optional |
Integer |
The timeout period of service execution in seconds. Its range is [1-60], with a default value of 30 seconds. |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
value |
Mandatory |
String, Number, Array or Object |
The parameter value for measurement point setting, the value data type of which will be as per defined in the thing model. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Command ID Struct |
The measurement point setting results. For details, see Command ID Struct. |
Command ID Struct ¶
Name |
Data Type |
Description |
---|---|---|
commandId |
String |
The command ID. |
Error Codes¶
Code |
Message |
Description |
---|---|---|
11404 |
Invalid timeout value |
The |
For other error codes, see Error Codes.
Samples¶
Request Sample¶
url: https://{apigw-address}/connect-service/v2.1/commands?action=setMeasurepoint&deviceKey=yourDeviceKey&measurepointId=measurepoint1&&pendingTtl=1000&productKey=yourProductKey&orgId=yourOrgId&timeout=30
method: POST
requestBody:
{
"value":1.0
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "7d863d517eae4f18a2776452eb1305bb",
"data": {
"commandId": "2078724684846989312"
}
}
SDK Samples¶
You can access the SDK samples for Connection Service on GitHub: