V2.5 Allocate DPS Device


Allocate and activate a DPS device.


This API is only available if 2.4 Cumulative Update 2 has been applied to your environment.

Request Format

POST https://{apigw-address}/dps-service/v2.5/pvs/device?action=allocate

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 is blank or invalid.

35404

Group/Device group not found

Registration group or master data group does not exist.

35601

Verify not pass/sn not found

The device SN does not exist or is invalid.

Samples

Request Sample

url: https://{apigw-address}/dps-service/v2.5/pvs/device?action=allocate&orgId=yourOrgId
method: POST
requestBody:
{
    "sn": "yourSn",
    "deviceData": {
        "max_capacity": 1.0,
        "scale": 1
    }
}

Return Sample

{
  "code": 0,
  "msg": "OK",
  "requestId": "fb8495da-fa7d-4ba6-b105-bcc75517e0d8",
  "data": {
    "sn": "yourSn",
    "groupId": "yourGroupId",
    "regionId": "regionId",
    "orgId": "yourOrgId",
    "productKey": "yourProductKey",
    "batchOrder": 723,
    "batchTag": {
      "defaultValue": "yourDevice",
      "i18nValue": {}
    },
    "deviceData": {
      "date": "2023-06-08",
      "commDeviceSn": "yourDevice",
      "seqNo": 1,
      "timezone": "+14:00",
      "optModel": "yourDevice",
      "deviceName": {
        "defaultValue": "yourDevice",
        "i18nValue": {
          "en_US": "yourDevice",
          "zh_CN": "yourDevice",
          "ja_JP": "yourDevice",
          "es_ES": "yourDevice"
        }
      },
      "deviceSn": "yourDevice",
      "orgId": "o15735524440141",
      "capacity": 12,
      "capacity_rated": 11,
      "assetId": "yourAssetId",
      "parentDeviceSn": "yourDevice",
      "optIndex": [
        "yourDevice",
        "yourDevice"
      ],
      "optVersion": "yourDevice",
      "tokenReplacing": "yourDevice",
      "optSN": [
        "yourDevice",
        "yourDevice"
      ],
      "topoSize": 11,
      "modelID": "yourDevice",
      "version": "yourDevice",
      "enum": "DISTRIBUTED",
      "modelName": "yourDevice",
      "regionId": "beta",
      "regcode": "yourDevice",
      "tokenInUse": "yourDevice"
    },
    "desc": "yourDevice",
    "status": {
      "currentStatus": "allocated",
      "connectedTime": null,
      "allocatedTime": 1690779060469,
      "finishedTime": null,
      "discardedTime": null
    },
    "reprovisioning": false,
    "allocateErrorMsg": null,
    "createBy": null,
    "createTime": 1690775762727,
    "updateBy": null,
    "updateTime": 1690775762727,
    "manufacturerOrgId": "manufacturerOrgId",
    "connectStatus": "init",
    "allocateStatus": "allocated"
  }
}