V4.0 Allocate DPS Device(Deprecated)¶
Allocate and activate a DPS device.
This version will be deprecated. It is recommended to use V2.5 Allocate DPS Device.
Request Format¶
POST https://{apigw-address}/dps-service/v4.0/pvs/device?action=activate
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Required/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Required |
String |
The organization ID which the device belongs to. How to get orgId>> |
Request Parameters (Body)¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
sn |
Required |
String |
The device SN that is generated by system and unique in this environment. |
deviceData |
Optional |
Map (Key is of String type and the Value is of Integer, String, Enum or Date type) |
The device master data. The Key is the identifier of the master data and the value must correspond to the data type pf the master data. Ensure that you have created the master data or use the built-in master data. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
PvsDevice Struct |
The information of the DPS device. For more information, see PvsDevice Struct. |
PvsDevice Struct ¶
Name |
Data Type |
Description |
---|---|---|
sn |
String |
The device SN that is generated by system and unique in this environment. |
groupId |
String |
The registration group ID. |
regionId |
String |
The ID of the region to which the device is allocated. |
orgId |
String |
The ID of the OU to which the device is allocated. |
productKey |
String |
The corresponding product key of the device in the EnOS Management Console. |
batchOrder |
Integer |
The device creation batch number. |
batchTag |
StringI18n |
The device creation batch tag. Internationalized name representation >> |
deviceData |
Map |
The device master data. |
desc |
String |
The device description. |
status |
PvsDeviceStatus Struct |
The current status of the device. For more information, see PvsDeviceStatus Struct. |
reprovisioning |
Boolean |
|
allocateErrorMsg |
String |
The information of the device’s last allocation failure. |
createBy |
String |
Ther user ID of the person who created the device. |
createTime |
Long |
The time the device was created. |
updateBy |
String |
The user ID of the person who updated the device. |
updateTime |
Long |
The time the device was updated. |
manufacturerOrgId |
String |
The ID of the organization where the device is pre-registered. |
connectStatus |
String |
The device connection status. Values include |
allocateStatus |
String |
The device allocation status. Values include |
PvsDeviceStatus Struct ¶
Name |
Data Type |
Description |
---|---|---|
currentStatus |
String |
The device current status. Values include |
connectedTime |
Long |
The time the device was connected. |
allocatedTime |
Long |
The time the device was allocated. |
finishedTime |
Long |
The time the device finished activation. |
discardedTime |
Long |
THe time the device was discarded. |
Error Codes¶
Code |
Message |
Description |
---|---|---|
35400 |
OrgId/sn is required |
The orgId or serial number is blank or invalid. |
35601 |
Verify not pass/sn not found |
The serial number does not exist or is invalid. |
Samples¶
Request Sample¶
url: https://{apigw-address}/dps-service/v4.0/pvs/device?action=activate&orgId=yourOrgId
method: POST
requestBody:
{
"sn": "yourSn",
"deviceData": {
"deviceSn": "yourDeviceSn"
}
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "96f072bf-27d6-4c1d-b4a1-5df4e6367ad8",
"data": {
"sn": "yourSn",
"groupId": "yourGroupId",
"regionId": "beta",
"orgId": "yourOrgId",
"productKey": "yourProductKey",
"batchOrder": 3,
"batchTag": {
"defaultValue": "tag1",
"i18nValue": {}
},
"deviceData": {
"date": "2022-10-26",
"energyType": "steam",
"accessCapacity": null,
"regionId": "beta",
"timezone": "+09:00",
"assetId": "yourAssetId",
"energyUseLink": "consumption",
"isDtu": null,
"deviceSn": "yourDeviceSn",
"deviceName": {
"i18nValue": {}
},
"orgId": "yourOrgId",
"isDtuSub": null
},
"desc": "test",
"status": {
"currentStatus": "allocated",
"connectedTime": null,
"allocatedTime": 1666847119072,
"finishedTime": null,
"discardedTime": null
},
"reprovisioning": false,
"allocateErrorMsg": null,
"createBy": null,
"createTime": 1666846864447,
"updateBy": null,
"updateTime": 1666846864447,
"connectStatus": "init",
"allocateStatus": "allocated"
}
}