V2.5 Replace DPS Device¶
Replace a DPS device. Copy the master data, batch tags, and description of the original device to the specified new device, and delete the original device.
This API is only available if 2.4 Cumulative Update 2 has been applied to your environment.
Prerequisites¶
Ensure that the master data groups and registration groups has been created for the DPS devices in EnOS Management Console.
Request Format¶
POST https://{apigw-address}/dps-service/v2.5/pvs/device?action=replace
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)¶
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 the information of the device is blank or invalid. |
35400 |
Target device and replacement device should belong to the same group |
The original and new devices must be in the same registration group. |
35404 |
Sn not found |
The serial number does not exist. |
35603 |
Replacement device is allocated |
The new device has been allocated. |
Samples¶
Request Sample¶
url: https://{apigw-address}/dps-service/v2.5/pvs/device?action=replace&orgId=yourOrgId
method: POST
requestBody:
{
"sn": "originalSn",
"replacementSn" : "newSn"
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "96f072bf-27d6-4c1d-b4a1-5df4e6367ad8",
"data": {
"sn": "newSn",
"groupId": "groupId",
"regionId": "beta",
"orgId": "yourOrgId",
"productKey": "productKey",
"batchOrder": 3,
"batchTag": {
"defaultValue": "tag1",
"i18nValue": {}
},
"deviceData": {
"date": "2022-10-26",
"energyType": "steam",
"accessCapacity": null,
"regionId": "beta",
"timezone": "+09:00",
"assetId": "assetId",
"energyUseLink": "consumption",
"isDtu": null,
"deviceSn": "deviceSn",
"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"
}
}