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.

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