创建设备

POST /api/v1/devices

创建设备实例

请求参数

参数名 类型 必填 描述 限制
deviceName string 模型名称 设备名称不能重复
projectId string 项目标识
modelId string 模型标识
status Enum<String> 状态 取值
Active:激活状态
Locked:锁定状态
comments string 设备备注
virtual Boolean 默认:false
metadata Map<String,Object> 设备元数据

请求样例

POST /api/v1/devices HTTP/1.1
Host: 60.205.223.53:8443
Content-Type: application/json
Authorization: Bearer xxx.xxxx.xxx
Cache-Control: no-cache
Postman-Token: cadfb57b-9f64-3b55-f3ea-559e8051cd6a

{
  "deviceName": "deviceName-2222",
  "projectId": "3ebc7aa1-18e1-43f7-b198-68bbdd97304d",
  "modelId": "9e1a567d-e375-472e-a144-fa9eb8e990b4",
  "status": "Active",
  "comments": "comments is nothing",
  "virtual": false,
  "metadata": {}
}

响应参数

参数名 类型 必填 描述 限制
id string 设备标识
deviceName string 设备名称
projectId string 设备所属项目标识
modelId string 设备所属模型标识
status Enum<string> 设备状态 取值
Active:激活状态
Locked:锁定状态
accessToken string 设备访问令牌
isVirtual boolean 是否虚拟设备
comments string 备注
deviceModelType Enum<string> 设备模型类型
deviceModelName string 设备模型名称
projectName string 项目名称
hasActions boolean 设备是否提供操作接口
deviceModelUrl string 设备模型图片URL
metadata Map<String, Object> 设备元数据

响应样例

{
    "returnCode": 0,
    "result": {
        "createdBy": "augur@glodon.cn",
        "createdTime": 1505812282426,
        "tenantId": "fabc4ec1-3ac4-415d-a28a-d456955a9e37",
        "id": "e52da2c1-f849-4fa8-bcd1-16b6c9fd01da",
        "deviceName": "deviceName-3",
        "projectId": "39b1f096-3471-4ba3-ab1e-dcb9fb704641",
        "modelId": "9517ff68-2c43-4709-ab69-e1ae6062640c",
        "status": "Active",
        "accessToken": "d885d4fc-23c8-452e-978d-948611cdb377",
        "isVirtual": false,
        "comments": "comments is nothing",
        "deviceModelType": "Light",
        "deviceModelName": "testforsdk2",
        "projectName": "solutionNameUpdate",
        "hasActions": false,
        "virtual": false,
        "deleted": false,
        "metadata": {}
    }
}