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