有奖捉虫:办公协同&微信生态&物联网文档专题 HOT

1. 接口描述

接口请求域名:iot.cloud.tencent.com/api/exploreropen/serviceapi。 本接口(ServiceDescribeModelDefinition)用于查询产品数据模板。

2. 输入参数

名称
类型
必选
描述
Action
String
公共参数,本接口取值:ServiceDescribeModelDefinition。
RequestId
String
公共参数,唯一请求 ID,可自行生成,推荐使用 uuid。定位问题时,需提供该次请求的 RequestId。
AppKey
String
公共参数,物联网 SaaS 的 AppKey ,用于标识对应的物联网 SaaS。
Signature
String
公共参数,请求签名,需用户自行生成,用于校验请求的合法性。
Timestamp
Int64
公共参数,请求的 Unix 时间戳(秒级)。
Nonce
Int
公共参数,随机正整数,与 Timestamp 联合起来,防止重放攻击。
ProductId
String
产品 ID。

3. 输出参数

名称
类型
描述
RequestId
String
公共参数,唯一请求 ID,与入参相同。
Model
返回数据。

4. 示例

输入示例
POST https://iot.cloud.tencent.com/api/exploreropen/serviceapi HTTP/1.1
content-type: application/json
{
"RequestId": "f92406b3-****-4fe8-bc43-45e3d794bb68",
"Timestamp": 1599468019,
"Nonce": 170533123,
"AppKey": "AppKey",
"Signature": "Signature",
"Action": "ServiceDescribeModelDefinition",
"ProductId": "22F****I7O"
}

输出示例: 成功
{
"Response": {
"Model": {
"CategoryModel": "{\\"version\\":\\"1.0\\",\\"profile\\":{\\"productID\\":\\"*\\"},\\"properties\\":[],\\"events\\":[]}",
"CreateTime": 1556588325,
"ModelDefine": "{\\"version\\":\\"1.0\\",\\"profile\\":{\\"ProductId\\":\\"WTJTZX0MF2\\",\\"CategoryId\\":\\"31\\"},\\"properties\\":[{\\"id\\":\\"power_switch\\",\\"name\\":\\"电灯开关\\",\\"desc\\":\\"控制电灯开灭\\",\\"required\\":true,\\"mode\\":\\"rw\\",\\"define\\":{\\"type\\":\\"bool\\",\\"mapping\\":{\\"0\\":\\"关\\",\\"1\\":\\"开\\"}}},{\\"id\\":\\"color\\",\\"name\\":\\"颜色\\",\\"desc\\":\\"灯光颜色\\",\\"mode\\":\\"rw\\",\\"define\\":{\\"type\\":\\"enum\\",\\"mapping\\":{\\"0\\":\\"Red\\",\\"1\\":\\"Green\\",\\"2\\":\\"Blue\\"}}},{\\"id\\":\\"brightness\\",\\"name\\":\\"亮度\\",\\"desc\\":\\"灯光亮度\\",\\"mode\\":\\"rw\\",\\"define\\":{\\"type\\":\\"int\\",\\"unit\\":\\"%\\",\\"step\\":\\"1\\",\\"min\\":\\"0\\",\\"max\\":\\"100\\",\\"start\\":\\"1\\"}},{\\"id\\":\\"name\\",\\"name\\":\\"灯位置名称\\",\\"desc\\":\\"灯位置名称:书房、客厅等\\",\\"mode\\":\\"rw\\",\\"required\\":false,\\"define\\":{\\"type\\":\\"string\\",\\"min\\":\\"0\\",\\"max\\":\\"64\\"}}],\\"events\\":[{\\"id\\":\\"status_report\\",\\"name\\":\\"DeviceStatus\\",\\"desc\\":\\"Report the device status\\",\\"type\\":\\"info\\",\\"required\\":false,\\"params\\":[{\\"id\\":\\"status\\",\\"name\\":\\"running_state\\",\\"desc\\":\\"Report current device running state\\",\\"define\\":{\\"type\\":\\"bool\\",\\"mapping\\":{\\"0\\":\\"normal\\",\\"1\\":\\"fault\\"}}},{\\"id\\":\\"message\\",\\"name\\":\\"Message\\",\\"desc\\":\\"Some extra message\\",\\"define\\":{\\"type\\":\\"string\\",\\"min\\":\\"0\\",\\"max\\":\\"64\\"}}]},{\\"id\\":\\"low_voltage\\",\\"name\\":\\"LowVoltage\\",\\"desc\\":\\"Alert for device voltage is low\\",\\"type\\":\\"alert\\",\\"required\\":false,\\"params\\":[{\\"id\\":\\"voltage\\",\\"name\\":\\"Voltage\\",\\"desc\\":\\"Current voltage\\",\\"define\\":{\\"type\\":\\"float\\",\\"unit\\":\\"V\\",\\"step\\":\\"1\\",\\"min\\":\\"0.0\\",\\"max\\":\\"24.0\\",\\"start\\":\\"1\\"}}]},{\\"id\\":\\"hardware_fault\\",\\"name\\":\\"Hardware_fault\\",\\"desc\\":\\"Report hardware fault\\",\\"type\\":\\"fault\\",\\"required\\":false,\\"params\\":[{\\"id\\":\\"name\\",\\"name\\":\\"Name\\",\\"desc\\":\\"Name like: memory,tf card, censors ...\\",\\"define\\":{\\"type\\":\\"string\\",\\"min\\":\\"0\\",\\"max\\":\\"64\\"}},{\\"id\\":\\"error_code\\",\\"name\\":\\"Error_Code\\",\\"desc\\":\\"Error code for fault\\",\\"define\\":{\\"type\\":\\"int\\",\\"unit\\":\\"\\",\\"step\\":\\"1\\",\\"min\\":\\"0\\",\\"max\\":\\"2000\\",\\"start\\":\\"1\\"}}]}],\\"actions\\":[{\\"id\\":\\"echo\\",\\"name\\":\\"echo\\",\\"desc\\":\\"\\",\\"input\\":[{\\"id\\":\\"message\\",\\"name\\":\\"message\\",\\"define\\":{\\"type\\":\\"string\\",\\"min\\":\\"0\\",\\"max\\":\\"64\\"}}],\\"output\\":[{\\"id\\":\\"message\\",\\"name\\":\\"message\\",\\"define\\":{\\"type\\":\\"string\\",\\"min\\":\\"0\\",\\"max\\":\\"64\\"}}],\\"required\\":false}]}",
"NetTypeModel": "",
"ProductId": "22F****I70",
"UpdateTime": 1571855825
},
"RequestId": "f92406b3-****-4fe8-bc43-45e3d794bb68"
}
}

5. 错误码

错误码
描述
InternalError
内部错误。
ErrorRequiredParamNotFound
必选参数缺失。
InvalidAction
Action 非法。
InvalidParameterValue
参数非法。
InvalidParameterValue.InvalidJSON
请求格式不是 JSON。