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.

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"
  }
}