OpenAPI
更新时间:2018-12-18 18:41:45
简介
本文档参考飞象工业平台对外暴露的设备能力API,制定了如下端侧设备能力对外暴露的接口,除认证及设备事件订阅外,基本格式与云端保持一致。
公共参数
公共请求参数是指每个接口都需要使用到的请求参数。这些公共参数直接在URL里体现出来.
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
Format | String | 否 | 返回值的类型,支持JSON与XML。默认为JSON |
Version | String | 是 | API版本号,为日期形式:YYYY-MM-DD,本版本对应为2018-08-30 |
AccessKeyId | String | 否 | 合法的用户名,也是用户登陆的用户名 |
Signature | String | 否 | 签名结果串,关于签名的计算方法,请参见签名机制。 |
SignatureMethod | String | 否 | 签名方式,目前支持HMAC-SHA256 |
TimeStamp | String | 是 | 请求的时间戳。日期格式按照ISO8601标准表示,并需要使用UTC时间。格式为:YYYY-MM-DDThh:mm:ssZ。例如,2014-11-11T12:00:00Z(为北京时间2014年11月11日20点0分0秒) |
SignatureVersion | String | 否 | 签名算法版本,目前版本是1.0 |
SignatureNonce | String | 是 | 唯一随机数,用于防止网络重放攻击。用户在不同请求间要使用不同的随机数值 |
注意: 20181230版本之前,所有的公共参数均不做校验。
JSON 实例
目前所有的接口,均只支持 POST 方法.
#入参:
{
"id": UUID.v1(), //非必填
"version": "1.0", //非必填
"request": { //边缘计算端侧参数
"apiVer": "0.6" //边缘计算端侧api的入参
},
"params": { //边缘计算端侧api的入参
"key1": "value1",
"key2": "value2"
}
}
#出参:
{
"code": 200, //具体错误码,请参考文末错误码章节,若值为200,
//则开发者仅需关注data字段的内容接口,否者需要关注message字段的错误内容
"message": "", //只有code非200时才有效,类型可能为字符串或对象
"data": {} //服务器返回的数据,只有code为200时才有效
}
身份认证
登陆 Login
接口详情
PATH
/auth/login
HTTP Method
POST
功能描述
用户登陆认证接口,只有已登陆用户拿到合法cookie后才能进行相关API的调用. 开发者对其他所有接口的调用均需要携带本接口返回的cookie。
请求参数
参数名称 | 类型 | 是否必须 | 参数描述 |
---|---|---|---|
UserName | String | 是 | 用户名 |
Password | String | 是 | 对应的密码 |
正常返回实例
{
"code": 200,
"message": "success",
"data": {
//UserName: 用户名
"UserName": string
}
}
异常返回实例
{
"code": 400,
"message": "Invalid username or password",
"data": {
"User": string
}
}
实例:
输入:
curl -c "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"UserName\": \"admin\", \"Password\": \"admin1234\"}}" -k -X POST https://127.0.0.1:6999/auth/login
输出:
{"code": 200, "message": "success", "data":{"User": "admin"}}
登出 Logout
接口详情
参数名称 | 类型 | 是否必须 | 参数描述 |
---|---|---|---|
UserName | String | 是 | 用户名 |
正常返回参数实例
{
"code": 200,
"message": "success"
}
异常返回参数实例
{
"code": 400,
"message": "cookie is invalid"
}
实例
输入:
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"UserName\": \"admin\"}}" -k -X POST https://127.0.0.1:6999/auth/logout
输出:
{"code": 200, "message": "success", "data": {}}
网关管理
获取TSL
接口详情
参数名称 | 类型 | 是否必须 | 参数描述 |
---|---|---|---|
productKey | String | 否 | 产品productKey,可选,若为空则返回所有TSL,若存在则返回所有该产品下的TSL. |
PageSize | int | 是 | 一次返回条目的个数,若填0,则返回所有tsl列表. |
CurrentPage | int | 是 | 当前页码 |
正常返回参数实例
{
"code": 200,
"data": {
"TotalNum": int, //总共页数
"PageSize": int, //页面大小
"CurrentPage": int, //当前页数
"list":[
//productKey: 产品key, productName: 产品名称 standardTSL: 标准TSL, extendTSL: 扩展TSL
{"productKey": "asdf", "productName": "", "standardTSL": "asdf", "extendTSL": "asdf"},
{"productKey": "asdf", "productName": "", standardTSL": "asdf", "extendTSL": "asdf"}
]
},
"message": "success",
"localizedMsg": null
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
测试
输入:
curl -b "test_eweb.cookie" -k --data "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"PageSize\":10,\"CurrentPage\":1}}" https://127.0.0.1:6999/gateway/tsl/query
输出:
{"code": 200, "message": "success", "data":{"list":[{"extendTSL":"{}","productKey":"vaGGJ7Gm739","standardTSL":"{\n\t\"header\": {\n\t\t\"productKey\": \"\",\n\t\t\"manufacture\": \"Alibaba\",\n\t\t\"protocol\": \"fake_monitor\",\n\t\t\"description\": \"A fake device that represents a monitor.\"\n\t},\n\t\"properties\": [\n\t\t{\n\t\t\t\"identifier\": \"cpu_usage\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"float\",\n\t\t\t\t\"specs\": {\n\t\t\t\t\t\"unit\": \"%\",\n\t\t\t\t\t\"min\": 0,\n\t\t\t\t\t\"max\": 100,\n\t\t\t\t\t\"step\": 0.01\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"desc\": \"CPU usage.\"\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"cpu_core_number\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"int\",\n\t\t\t\t\"specs\": {\n\t\t\t\t\t\"unit\": \"\",\n\t\t\t\t\t\"min\": 1,\n\t\t\t\t\t\"max\": 128,\n\t\t\t\t\t\"step\": 1\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"desc\": \"CPU core number.\"\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"memory_usage\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"float\",\n\t\t\t\t\"specs\": {\n\t\t\t\t\t\"unit\": \"%\",\n\t\t\t\t\t\"min\": 0,\n\t\t\t\t\t\"max\": 100,\n\t\t\t\t\t\"step\": 0.01\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"desc\": \"Memory usage in percentage.\"\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"memory_total\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t},\n\t\t\t\"desc\": \"Total memory in bytes.\"\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"memory_free\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t},\n\t\t\t\"desc\": \"Free memory in bytes.\"\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"disk_usage\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"float\",\n\t\t\t\t\"specs\": {\n\t\t\t\t\t\"unit\": \"%\",\n\t\t\t\t\t\"min\": 0,\n\t\t\t\t\t\"max\": 100,\n\t\t\t\t\t\"step\": 0.01\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"gateway_product_key\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t\t\"specs\": {\n\t\t\t\t\t\"unit\": \"\"\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"gateway_version\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t},\n\t\t\t\"desc\": \"gateway software version.\"\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"system_info\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t},\n\t\t\t\"desc\": \"OS version.\"\n\t\t},\n\t\t{\n\t\t\t\"identifier\": \"gateway_ip\",\n\t\t\t\"accessMode\": \"r\",\n\t\t\t\"dataType\": {\n\t\t\t\t\"type\": \"string\",\n\t\t\t\t\"specs\": {\n\t\t\t\t\t\"unit\": \"\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"desc\": \"gateway IP.\"\n\t\t}\n\t],\n\t\"services\": [{\n \"identifier\": \"RemoteTerminalSwitch\",\n \"name\": \"RemoteTerminalSwitch\",\n \"desc\": \"开启/关闭远程调试\",\n \"inputData\": [\n {\n \"identifier\": \"switcher\",\n \"name\": \"开关\",\n \"dataType\": {\n \"type\": \"int\",\n \"specs\": {\n \"length\": \"1\"\n }\n }\n }\n ],\n \"outputData\": [],\n \"method\": \"thing.service.RemoteTerminalSwitch\"\n }],\n\t\"events\": []\n}\n\n"}],"CurrentPage":1,"TotalNum":1,"PageSize":10}}
删除TSL
接口详情
参数名称
|
类型
|
是否必须
|
参数描述
|
productKey
|
JsonArray
|
是
|
待删除的productKey列表,若为[]则删除所有TSL,否者,格式为:
["aaaa","bbbB","cccc"]
|
正常返回参数实例
{
"code": 200,
"data": {
},
"message": "success",
"localizedMsg": null
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
测试
输入:
curl -b "test_eweb.cookie" -k --data "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"productKey\":[\"a1cB3Yjpr58\"]}}" https://127.0.0.1:6999/gateway/tsl/delete
输出:
{"code": 200, "message": "success", "data":""}
导入TSL
接口详情
参数名称
|
类型
|
参数描述
|
productName
|
String
|
可选,该产品对应的productName
当前阶段,TSL文件名称即为产品名称。
|
standardTSL
|
JSON Object
|
标准TSL的内容,必须是合法的json对象.
|
extendTSL
|
String
|
允许为空,在该产品为modbus/opcua时可能需要。
|
正常返回参数实例
{
"code": 200,
"data": 20
"message": "success",
"localizedMsg": null
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
实例:
输入:
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"productName\": \"测试设备\", \"standardTSL\": {\"profile\":{\"productKey\":\"a1cB3Yjpr58\",\"manufacture\":\"\",\"protocol\":\"tcp/ip\",\"description\":\"\"},\"properties\":[{\"identifier\":\"bright\",\"accessMode\":\"rw\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"255\",\"min\":\"0\",\"unit\":\"\"}},\"desc\":\"亮度\"},{\"identifier\":\"temprature\",\"accessMode\":\"rw\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"80\",\"min\":\"0\",\"unit\":\"℃\"}},\"desc\":\"环境温度\"},{\"identifier\":\"power\",\"accessMode\":\"rw\",\"dataType\":{\"type\":\"enum\",\"specs\":{\"1\":\"开灯\",\"0\":\"关灯\"}},\"desc\":\"电源\"}],\"services\":[{\"identifier\":\"set\",\"inputData\":[{\"identifier\":\"bright\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"255\",\"min\":\"0\",\"unit\":\"\"}},\"desc\":\"亮度\"},{\"identifier\":\"temprature\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"80\",\"min\":\"0\",\"unit\":\"℃\"}},\"desc\":\"环境温度\"},{\"identifier\":\"power\",\"dataType\":{\"type\":\"enum\",\"specs\":{\"1\":\"开灯\",\"0\":\"关灯\"}},\"desc\":\"电源\"}],\"outputData\":[{}],\"desc\":\"设置>属性\"},{\"identifier\":\"get\",\"inputData\":[\"bright\",\"temprature\",\"power\"],\"outputData\":[{\"identifier\":\"bright\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"255\",\"min\":\"0\",\"unit\":\"\"}},\"desc\":\"亮度\"},{\"identifier\":\"temprature\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"80\",\"min\":\"0\",\"unit\":\"℃\"}},\"desc\":\"环境温度\"},{\"identifier\":\"power\",\"dataType\":{\"type\":\"enum\",\"specs\":{\"1\":\"开灯\",\"0\":\"关灯\"}},\"desc\":\"电源\"}],\"desc\":\"获取属性\"},{\"identifier\":\"breath\",\"inputData\":[{\"identifier\":\"threshold\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"255\",\"min\":\"0\",\"unit\":\"\"}},\"desc\":\"亮度阈值\"}],\"outputData\":[],\"desc\":\"呼吸灯\"}],\"events\":[{\"identifier\":\"high_temprature\",\"type\":\"alert\",\"outputData\":[{\"identifier\":\"temprature\",\"dataType\":{\"type\":\"int\",\"specs\":{\"max\":\"255\",\"min\":\"0\",\"unit\":\"\"}}}],\"desc\":\"高温告警\"}]}}}" -k -X POST https://127.0.0.1:6999/gateway/tsl/import
输出:
{"code": 200, "message": "success", "data":{"User": "admin"}}
获取网关配置
接口详情
参数名称 | 类型 | 默认值 | 参数描述 |
---|---|---|---|
正常返回参数实例
{
"code": 200,
"data": {
"productKey": "aaa", //网关的pk
"deviceName": "bbbb", //网关的dn
"deviceSecret": "ccc", //网关的sc
"subDevice":[ //待实现
//productKey: 子设备的pk, deviceSecret: 私钥, deviceName: 子设备的dn
{"productKey": "aaa", "deviceSecret": "bbb", "deviceName": "ccc"},
{"productKey": "aaa", "deviceSecret": "bbb", "deviceName": "ccc"},
{"productKey": "aaa", "deviceSecret": "bbb", "deviceName": "ccc"}
]
},
"message": "success",
"localizedMsg": null
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
测试
输入:
curl -b "test_eweb.cookie" -k --data "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{}}" https://30.43.92.132:28999/gateway/config/query
输出:
{"data":{"deviceSecret":"uxgPuym0cyCeBp04xkK6fF2qT1Mijltf","deviceName":"openapi_coap_test_gw","productKey":"b1xONObVJKc","subDevice":[{"deviceSecret":"74ao4bIKyPvc4WDv3Bd1","deviceName":"nJ4UoqF9OyPObqa3dVngIaR7SQHoMhmv","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"899XalOcwDfKO5curQ9w","deviceName":"YTgOI3oOdT6iuUdkYPigDnPIO0YO8wei","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"A5jtjg7g8DA6c556VVt7","deviceName":"WFixQ7as1N96H3E7JbQDH6yWf4yTLkAv","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"BOlJLxlBsMX8BPrNrabV","deviceName":"FUc9tz12J7vlW9DjCoAcYZM71Lne1RWT","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"bovTbRkoTXjm68UOhx3i","deviceName":"Nq0Zszkg09j4O95QWlU2Y7jgTJEdGWLg","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"lYZvRQ01IDi4FXtVALd1","deviceName":"iB1TkhEPfeuGkFjiKCKtn9nZHZ9esGoY","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"Ne2yJIzyUIjcQsRzqlBO","deviceName":"22ZMZneiof1KYA91iqtKoJ3tRJ2gHdJ3","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"pRPiBqTZWflIgkyFSmHf","deviceName":"nw2BBtQhJ89MXuBAdXY25HJVid0lXSUJ","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"TGr3cls8aCMK8cue9SAw","deviceName":"ZIiyVMNLOFxazihUBNYGBjGPthXfmiDr","productKey":"a1JJ3QE3CL2"},{"deviceSecret":"xkQzJzq9jEoenTKe73wB","deviceName":"DtalZnRpkuLmL98GpiIux7f18vQmIXP1","productKey":"a1JJ3QE3CL2"}]},"code":200,"message":"success"}
驱动管理
获取驱动列表
接口详情
参数名称 | 类型 | 默认值 | 参数描述 |
---|---|---|---|
PageSize | int | 10 | 一次返回条目的个数, 如果填 0 , 则返回所有的驱动配置。 |
CurrentPage | int | 1 | 当前页码 |
正常返回参数实例
{
"code": 200,
"message": "success",
"data": {
"TotalNum": int,
"PageSize": int,
"CurrentPage": int, //从1开始计算
"List": [
//DriverType: Manual,针对连接参数静态指定的设备的驱动类型;Auto,针对动态自动连接的设备的驱动类型;All,指同时具备这两种属性
//DriverState: 驱动状态, true 表示运行, false表示不在运行.
//DeviceNum:该驱动下设备总个数(包括认证和未认证的子设备)
//LoadTime:驱动加载时间(epoch time)
{"DriverName": string, "DriverType": string, "DriverState": boolean, "DeviceNum": int, "LoadTime": int, "Deletable": fase},
{"DriverName": string, "DriverType": string, "DriverState": boolean, "DeviceNum": int, "LoadTime": int, "Deletable": fase},
{"DriverName": string, "DriverType": string, "DriverState": boolean, "DeviceNum": int, "LoadTime": int, "Deletable": fase}
]
}
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
实例:
输入:
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"PageSize\":10,\"CurrentPage\":1}}" -k -X POST https://127.0.0.1:6999/driver/list/query
输出:
{"code": 200, "message": "success", "data":{"List":[{"Deletable":true,"LoadTime":"1536379446","DriverName":"SampleDriver","DriverType":"All","DriverState":"working","DeviceNum":0},{"Deletable":true,"LoadTime":"1536378814","DriverName":"LedDriver","DriverType":"All","DriverState":"working","DeviceNum":0}],"CurrentPage":1,"TotalNum":2,"PageSize":10}}
新增驱动
接口详情
参数名称
|
类型
|
参数描述
|
DriverLanguage
|
string
|
驱动 编程语言: c/Node.js/Python。当前仅支持c
|
DriverName
|
string
|
当前驱动名称
|
DriverDesc
|
string
|
驱动描述
|
DriverZipPackagePath
|
string
|
驱动的本地zip包路径,必须是绝对路径。
如果需要驱动上传,需要调用
文件上传接口实现。
|
正常返回参数实例
{
"code": 200,
"message": "success",
"data": {}
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
测试
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"DriverLanguage\": \"c\", \"DriverName\": \"sshd_agent\", \"DriverDesc\": \"this is desc \", \"DriverZipPackagePath\": \"/xxxx/tmp/Release_V1.5_0830/build/bin/test2\"}}" -k -X POST https://127.0.0.1:6999/driver/add
# 输出
{"code": 200, "message": "success", "data":""}
删除驱动
接口详情
参数名称 | 类型 | 参数描述 |
---|---|---|
DriverName | string | 驱动名称 |
正常返回参数实例
{
"code": 200,
"message": "success",
"data": {}
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
测试
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"DriverName\": \"SampleDriver\"}}" -k -X POST https://127.0.0.1:6999/driver/del
# 输出
{"code": 200, "message": "success", "data":"file removed cleanly"}
获取驱动配置
接口详情
参数名称 | 类型 | 是否必须 | 参数描述 |
---|---|---|---|
DriverName | String | 是 | 驱动名称 |
正常返回参数实例
{
"code": 200,
"data": {
"driverConfig":{},
"serverList": {},
"deviceList": {}
},
"message": "success",
"localizedMsg": null
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
测试
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"DriverName\": \"SampleDriver\"}}" -k -X POST https://127.0.0.1:6999/driver/config/query
# 输出
{"data":{"driverConfig":{"DriverDesc":"只是一个模拟的driver而已","DriverLanguage":"c","DriverZipPackagePath":"/xxxx/tmp/Release_V1.5_0830/build/bin/SampleDriver","DriverName":"SampleDriver"}},"code":200,"message":"success"}
设置驱动配置
接口详情
参数名称 | 类型 | 参数描述 |
---|---|---|
DriverName | String | 驱动名称,不能为空。 |
DriverConfig | JSON | 驱动的配置内容,根据驱动类型,格式略有不同,具体参考下表。 |
- 驱动配置的具体格式
```plain
//必须符合以下格式规范,否者将无法设置成功。
{
"driverConfig": {},
"serverList": [{},
], "deviceList": [{},{}
] }{}
//如果驱动类型是modbus, serverList内容如下:
"serverList":[{//TCP 类型
"serverId": "服务器索引,设备与服务器关联",
"protocol": "协议类型,TCP或者RTU",
"name": "服务器名称",
"ip": "服务器连接地址",
"port": "服务器连接端口"
},
{//RTU 类型
"serverId": "服务器索引,设备与服务器关联",
"protocol": "RTU",
"name": "服务器名称",
"serialPort": "串口号",
"baudRate": "波特率",
"byteSize": "波特率",
"parity": "奇偶校验位(3: 偶校验, 2:奇校验, 1: 无校验)",
"stopBits": "停止位"
}
]
//如果驱动类型是opcua, serverList内容如下:
"serverList":[{
"serverId": "0", //------------------------服务器索引,用来设备与服务器关联
"url": "opc.tcp://localhost:4840", //---服务器连接地址
"userName": null, //----------------------登录用户名,如果没有账户和密码,填空字符串
"password": null, //----------------------账户密码,如果没有账户和密码,填空字符串,必须是加密后的字符串,格式为: 密码加密算法是采用AES-256,加密模式是CBC,加密密钥是网关密钥,加密初始向量取加密密钥前16字节,加密后数据进行base64编码
"secPolicy": "None", //-------------------加密策略,["None","Basic128Rsa15", "Basic256"]
"secMode": "None", //--------------------加密模式,["None","Sign","SignAndEncrypt"]
"certificate": null, //注意,如果有证书,则该处为证书在网关上所处的绝对路径
"privateKey": null, //注意,如果有证书,则该处为证书在网关上所处的绝对路径
"timeout": 5 //--------------------------方法调用超时时间
}]
//如果驱动类型是websocket
{
"driverConfig": {},
"serverList": [{
"ip": "127.0.0.1", //服务端地址,可以填空null或者合法的ipv4地址
"port": 7682, //端口,整形
"auth_mode", 1, //0: 不认证, 1: 单向认证(设备认证服务端), 2: 双向认证
"certification": "/home/chunk/ca.pem", //服务器根证书,必须是合法的已存在绝对路径
"privateKey": "/home/chunk/server_pri.key",//服务器私钥,必须是合法的已存在绝对路径
"publicKey": "/home/chunk/server_pub.key",//服务器公钥,必须是合法的已存在绝对路径
"is_self_signature_allowed": true,//是否允许设备证书是自签名
"timeout": 6, //消息超时时间,若tiemout时间内未收到设备数据则中断连接.
"client_certification": [ //设备端根证书列表,若为双向加密,则必须提供该值,必须是合法的已存在绝对路径
"/home/chunk/device1_ca.pem", "/home/chunk/device2_ca.pem", "/home/chunk/device3_ca.pem"
]
}],
"deviceList": [{
"productKey": "aaa", //pk
"deviceName": "bbb",//dn
"deviceAlias": "dddd"//设备别名
},
{
"productKey": "aaa",
"deviceName": "bbb",
"deviceAlias": "dddd"
}
]
}
//其他类型驱动格式为
{
"driverConfig": {},
"serverList": [{},
{}
],
"deviceList": [{},
{}
]
}
#### <a name="qi63mo"></a>正常返回参数实例
```json
{
"code": 200,
"data": 20,
"message": "success",
"localizedMsg": null
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
实例:
设置modbus驱动的配置
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"DriverName\": \"modbus\", \"DriverConfig\": {\"deviceList\":[{\"deviceConfig\":{\"serverId\":\"D14670544C5644F1AC3282561900DE67\",\"slaveId\":226},\"deviceName\":\"modbus_device1\",\"productKey\":\"a12CK1MJ0qW\"}],\"driverConfig\":{},\"serverList\":[{\"ip\":\"127.0.0.1\",\"name\":\"serv2\",\"port\":15020,\"protocol\":\"TCP\",\"serverId\":\"D14670544C5644F1AC3282561900DE67\"}],\"templateType\":0}}}}}" -k -X POST https://127.0.0.1:6999/driver/config/set
{"code": 200, "message": "success", "data": {}}
设置opcua驱动的配置
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"DriverName\": \"opcua\", \"DriverConfig\": {\"driverConfig\":{\"用户定义属性\":\"比如设备作为服务器的参数配置\"},\"serverList\":[{\"serverId\":\"51B4F019BB3747CE8C575BD817FE3AB3\",\"url\":\"opc.tcp://localhost:4840\",\"userName\":\"123\",\"password\":\"zorY48Jq0vH73H84OpEb2Q==\",\"secPolicy\":\"None\",\"secMode\":\"None\",\"certificate\":\"/xxxx/tmp/Release_V1.5_0830/build/bin/sshd_agent\",\"privateKey\":\"/xxxx/tmp/Release_V1.5_0830/build/bin/sshd_agent\",\"timeout\":5}],\"deviceList\":[{\"productKey\":\"b1xONObVJKc\",\"deviceName\":\"openapi_gw\",\"deviceConfig\":{\"serverId\":\"51B4F019BB3747CE8C575BD817FE3AB3\",\"displayNamePath\":\"Objects/Device1\"}},{\"productKey\":\"b2xONObVJKc\",\"deviceName\":\"openapi_gw\",\"deviceConfig\":{\"serverId\":\"51B4F019BB3747CE8C575BD817FE3AB3\",\"displayNamePath\":\"Objects/a\"}}]}}}}}" -k -X POST https://127.0.0.1:6999/driver/config/set
{"code": 200, "message": "success", "data": {}}
设置websocket驱动的配置
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"DriverName\": \"websocket\", \"DriverConfig\": {\"driverConfig\":{},\"serverList\":[{\"ip\":\"127.0.0.1\",\"port\":7682,\"auth_mode\":2,\"certification\":\"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem\",\"privateKey\":\"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem\",\"publicKey\":\"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem\",\"is_self_signature_allowed\":true,\"timeout\":6,\"client_certification\":[\"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem\",\"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem\",\"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem\"]}],\"deviceList\":[{\"productKey\":\"b1xONObVJKc\",\"deviceName\":\"openapi_gw\",\"deviceAlias\":\"dddd\"},{\"productKey\":\"b1xONObVJKc\",\"deviceName\":\"openapi_gw2\",\"deviceAlias\":\"dddd\"}]}}}}}" -k -X POST https://127.0.0.1:6999/driver/config/set
{"code": 200, "message": "success", "data": {}}
查询websocket驱动的配置
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"DriverName\": \"websocket\"}}" -k -X POST https://127.0.0.1:6999/driver/config/query
{"data":{"deviceList":[{"deviceAlias":"dddd","deviceName":"openapi_gw","productKey":"b1xONObVJKc"},{"deviceAlias":"dddd","deviceName":"openapi_gw2","productKey":"b1xONObVJKc"}],"serverList":[{"privateKey":"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem","is_self_signature_allowed":true,"client_certification":["/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem","/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem","/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem"],"certification":"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem","ip":"127.0.0.1","publicKey":"/xxxx/tmp/Release_V1.5_0830/build/bin/root.pem","auth_mode":2,"timeout":6,"port":7682}],"driverConfig":[]},"code":200,"message":"success"}
设备管理
★获取设备总数 queryThingCount
接口详情
参数名称 | 类型 | 默认值 | 参数描述 |
---|---|---|---|
productKey | String | 无 | 产品productKey |
activeStatus | int | 无 | 物的激活状态(null - ignore status,0 - 未激活,1 - 激活 |
onlineStatus | int | 无 | 物的在线状态(null - ignore status,0 - 离线,1 - 在线) |
正常返回参数实例
{
"code": 200,
"data": {"deviceCount": 30},
"message": "success",
"localizedMsg": null
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "resqust auth error",
"localizedMsg": ""
}
实例:
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {}}" -k -X POST https://127.0.0.1:6999/thing/device/count
# 输出
{"code": 200, "message": "success", "data":{"deviceCount":4}}
获取已认证设备列表
接口详情
参数名称
|
类型
|
是否必须
|
参数描述
|
实例
|
productKey
|
String
|
否
|
产品标识符
|
xxx
|
driverName
|
String
|
否
|
驱动名称
|
zzz
|
DeviceTags
|
JSON
|
否
|
标签列表
|
["tag1=val1", "tag2=val2", "tag3=val3"]
|
LocalState
|
string
|
否
|
本地在线状态: 可选值为:
Online/Offline
|
Online
|
CloudState
|
string
|
否
|
云端在线状态, 可选值为:
Inactive/ActivationFailed/Online/Offline
|
Online
|
PageSize
|
int
|
10
|
一次返回条目的个数, 如果填 0 , 则返回所有。
|
1
|
CurrentPage
|
int
|
1
|
当前页码
|
1
|
SortMethod
|
String
|
TimeDesc
|
排序方式,非必填,默认是"TimeDesc" 时间逆序,亦填"TimeAsc" 时间正序.其他值则都认为是默认值。
|
SortMethod: TimeDesc
|
正常返回参数实例
{
"code": 200,
"data": {
"TotalNum": int,
"PageSize": int,
"CurrentPage": int, //从1开始计算
"List": [
//LocalState: [Inactive, ActivationFailed, Online, Offline], Inactive,未激活;ActivationFailed,激活失败;Online,本地在线;Offline,本地离线
//CloudState: [Inactive, ActivationFailed, Online, Offline], Inactive,未激活;ActivationFailed,激活失败;Online,云端在线;Offline,云端离线
{"ProductKey": string, "DeviceName": string, "DriverName": string, "DeviceLocalId": string, "DeviceTags": [string, string, string], "LocalState": string, "CloudState": string, "LastLocalOnlineTime": string, "LastCloudOnlineTime": string},
{"ProductKey": string, "DeviceName": string, "DriverName": string, "DeviceLocalId": string, "DeviceTags": [string, string, string], "LocalState": string, "CloudState": string, "LastLocalOnlineTime": string, "LastCloudOnlineTime": string},
{"ProductKey": string, "DeviceName": string, "DriverName": string, "DeviceLocalId": string, "DeviceTags": [string, string, string], "LocalState": string, "CloudState": string, "LastLocalOnlineTime": string, "LastCloudOnlineTime": string}
]
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {\"PageSize\": 15, \"CurrentPage\": 1}}" -k -X POST https://127.0.0.1:6999/thing/device/list-authed
# 输出
{"code": 200, "message": "success", "data":{"List":[{"LocalState":"Offline","DriverName":"websocket","LastCloudOnlineTime":"1536538951000","DeviceName":"F3eKBL2fLEQxSSh2KEwG","CloudState":"Offline","DeviceTags":[],"LastLinkTime":"1536538951000","ProductKey":"a1JJ3QE3CL2","LastLocalOnlineTime":"1536538951000","DeviceLocalId":"abcabcedfg2"},{"LocalState":"Offline","DriverName":"websocket","LastCloudOnlineTime":"1536538950000","DeviceName":"bdzP2VNc6mSaaY3Uicnj","CloudState":"Offline","DeviceTags":[],"LastLinkTime":"1536538950000","ProductKey":"a1JJ3QE3CL2","LastLocalOnlineTime":"1536538950000","DeviceLocalId":"abcabcedfg1"},{"LocalState":"Offline","DriverName":"websocket","LastCloudOnlineTime":"1536538490000","DeviceName":"B62SxMDuQ3oWoqAJ5RMS","CloudState":"Offline","DeviceTags":[],"LastLinkTime":"1536538490000","ProductKey":"a1JJ3QE3CL2","LastLocalOnlineTime":"1536538490000","DeviceLocalId":"abcabcedfg0"},{"LocalState":"Online","DriverName":"gateway_monitor","LastCloudOnlineTime":"1536344986000","DeviceName":"openapi_gw","CloudState":"Online","DeviceTags":[],"LastLinkTime":"1536344986000","ProductKey":"b1xONObVJKc","LastLocalOnlineTime":"1536344986000","DeviceLocalId":"openapi_gw"}],"CurrentPage":1,"TotalNum":4,"PageSize":15}}
获取未认证设备列表(已废弃)
接口详情
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
productKey | String | N/A | 产品标识符 | xxx |
deviceLocalName | String | N/A | 物的注册请求名称 | yyyy |
driverName | String | N/A | 驱动名称 | zzz |
deviceTags | JSON | N/A | 标签列表 | ["tag1=val1", "tag2=val2", "tag3=val3"] |
PageSize | int | 10 | 一次返回条目的个数, 如果填 0 , 则返回所有。 | 1 |
CurrentPage | int | 1 | 当前页码 | 1 |
SortMethod | String | TimeDesc | 排序方式,非必填,默认是"TimeDesc" 时间逆序,亦填"TimeAsc" 时间正序 | SortMethod: TimeDesc |
正常返回参数实例
{
"code": 200,
"data": {
"TotalNum": int,
"PageSize": int,
"CurrentPage": int, //从1开始计算
"List": [
//LocalState: [Inactive, ActivationFailed, Online, Offline], Inactive,未激活;ActivationFailed,激活失败;Online,本地在线;Offline,本地离线
//CloudState: [Inactive, ActivationFailed, Online, Offline], Inactive,未激活;ActivationFailed,激活失败;Online,云端在线;Offline,云端离线
{"ProductKey": string, "DeviceLocalId": string, "DriverName": string, "LastLinkTime": string},
{"ProductKey": string, "DeviceLocalId": string, "DriverName": string, "LastLinkTime": string},
{"ProductKey": string, "DeviceLocalId": string, "DriverName": string, "LastLinkTime": string}
]
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {\"PageSize\": 15, \"CurrentPage\": 1}}" -k -X POST https://127.0.0.1:6999/thing/device/list-unauthed
# 输出
{"code": 200, "message": "success", "data":{"List":[],"CurrentPage":1,"TotalNum":0,"PageSize":15}}
认证设备
接口详情
参数名称 | 类型 | 是否必须 | 参数描述 |
---|---|---|---|
DeviceList | JSON Array | 必填 | 待认证设备列表,格式如下 |
- DeviceList 格式 ```plain [ {"ProductKey": "aaaaa", "DeviceName": "bbBb", "DriverName": "modbus"}, {"ProductKey": "aaaaa", "DeviceName": "bbBb", "DriverName": "modbus"}, {"ProductKey": "aaaaa", "DeviceName": "bbBb", "DriverName": "modbus"} ]
#### <a name="32xyxd"></a>正常返回参数实例
```json
{
"code": 200,
"data": {},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 200,
"message": "success",
"data": {
"SuccessNum": 1,
"List": [],
"FailNum": 0
}
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {\"DeviceList\": [{\"ProductKey\": \"a1JJ3QE3CL2\", \"DeviceName\": \"KkhbJuZxB0ara4qxE7Xq\"}]}}" -k -X POST https://127.0.0.1:6999/thing/device/auth
# 输出
{"code": 200, "message": "success", "data":{"SuccessNum":1,"List":[],"FailNum":0}}
取消认证设备
接口详情
参数名称 | 类型 | 是否必须 | 参数描述 |
---|---|---|---|
DeviceList | JSON Array | 必填 | 待删除设备列表,格式如下 |
- DeviceList 格式 ```plain [ {"ProductKey": "aaaaa", "DeviceName": "bbBb"}, {"ProductKey": "aaaaa", "DeviceName": "bbBb"}, {"ProductKey": "aaaaa", "DeviceName": "bbBb"} ]
#### <a name="w3l2rb"></a>正常返回参数实例
```json
{
"code": 200,
"data": {},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": [{"ProductKey": "aaa", "DeviceName": "ccC", "FaileMessage": "ddd"}],
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {\"DeviceList\": [{\"ProductKey\": \"a1JJ3QE3CL2\", \"DeviceName\": \"F3eKBL2fLEQxSSh2KEwG\"}]}}" -k -X POST https://127.0.0.1:6999/thing/device/unauth
# 输出
{"code": 200, "message": "success", "data": ""}
获取未启用设备列表
接口详情
PATH
/thing/device/list-unallocated
HTTP Method
POST
功能描述
获取启用设备的列表,用户导入了三元组,若该三元组未分配到具体的驱动,则会出现在未启用设备列表中。
请求参数
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
ProductKey | String | 非必需 | 产品标识符 | xxx |
PageSize | int | 10 | 一次返回条目的个数, 如果填 0 , 则返回所有。 | 1 |
CurrentPage | int | 1 | 当前页码 | 1 |
正常返回参数实例
{
"code": 200,
"data": {
"TotalNum": int,
"PageSize": int,
"CurrentPage": int, //从1开始计算
"List": [
{"ProductKey": string, "ProductName": string},
{"ProductKey": string, "ProductName": string},
{"ProductKey": string, "ProductName": string}
]
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {\"PageSize\": 15, \"CurrentPage\": 1}}" -k -X POST https://127.0.0.1:6999/thing/device/list-unallocated
# 输出
{"code": 200, "message": "success", "data":{"List":[{"ProductKey":"a1JJ3QE3CL2","DeviceName":"01GrSekmZeInpN5sKaJv"},{"DeviceName":"07gw7RY5mDSgOrOFfXI4","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0Ab5BnsM64jBS0edrv3J","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0BGRbwmFjO3e9u4F56yE","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0HYJhuDl5pXQ7u294P12","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0KHtHn8CMQIVxrPiTORg","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0W5vX41J6MiE6mW7WXAj","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0WWHVpFPuhIfVa4Ko3vz","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0ZJkVyJW2hgsu393sxsj","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0cci6XHXvLx7IgPRmPZP","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0gdDyQA0YEKPUpmXU4wN","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0hjsbjJaAzbMVWqY8cas","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"},{"DeviceName":"0vTg8Lulcf7uoKiHmpjU","ProductKey":"a1JJ3QE3CL2","ProductName":"MyDeviceForTestOnly"}],"CurrentPage":1,"TotalNum":1001,"PageSize":15}}
设置设备标签
接口详情
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
ProductKey | string | 产品名 | |
DeviceName | string | 设备名 | |
DeviceTags | json | 设备标签列表 | ["aaa=bbb", "ccc=ddd"] |
正常返回参数实例
{
"code": 200,
"data": {},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 500,
"data": null,
"message": "cloud is not available",
"localizedMsg": ""
}
实例
# 输入
# 输出
同步设备标签
接口详情
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
正常返回参数实例
{
"code": 200,
"data": {},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 500,
"data": null,
"message": "cloud is not available",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {}}" -k -X POST https://127.0.0.1:6999/thing/device/tags/sync
# 输出
{"message":"success","code":500,"data":""}
设备能力访问
★设置属性 setThingProperties
接口详情
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
productKey | String | N/A | 产品标识符 | xxx |
deviceName | String | N/A | 物的名称 | yyyy |
properties | JSON | N/A | 属性列表 | {"property1":"xxx", "property2":"xxx"} |
正常返回参数实例
{
"code": 200,
"data": null,
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": { \"productKey\": \"a1VCsnA2il7\", \"deviceName\": \"cloud_sync_for_zy\", \"properties\": {\"cpu_core_number\": 1, \"aaa\": 2} }}" -k -X POST https://127.0.0.1:6999/thing/device/properties/set
# 输出
{"code": 200, "message": "success", "data":null}
★获取属性 getThingProperty
接口详情
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
productKey | String | N/A | 产品标识符 | xxx |
deviceName | String | N/A | 物的名称 | yyyy |
propertyIdentifier | String | N/A | 物的属性标识符 | yyyy |
正常返回参数实例
{
"code": 200,
"message": "success",
"data": [
{
"iotId;": "", //注意,iotId 在边缘端为空。
"batchId": "",
"attribute;": "xxx",
"group;": "", //注意,group 在边缘端为空。
"value": "xxxx",
"gmtModified": 1237891329
}
]
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": { \"productKey\": \"a1VCsnA2il7\", \"deviceName\": \"LedLight2\", \"propertyIdentifier\": \"power\"}}" -k -X POST https://127.0.0.1:6999/thing/device/property/query
# 输出
{"code": 200, "message": "success", "data":[{"iotId":"","gmtModified":"1535197619","batchId":"","attribute":"power","value":1,"groud":""}]}
★调用设备服务 invokeThingServices
接口详情
PATH
/thing/device/service/invoke
HTTP Method
POST
功能描述
物的服务调用.
请求参数
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
productKey | String | 无 | 物的产品标识符 | xxxxxx |
inputParams | JSON | 无 | 服务入参 | {"param1":"xxx", "param2":"xxx"} |
method | String | 无 | 服务方法 | LIGHT_ON_OFF |
deviceName | String | 无 | 物的名称 | xxxxxx |
正常返回参数实例
{
"code": 200,
"data": null,
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": { \"productKey\": \"a1VCsnA2il7\", \"deviceName\": \"LedLight2\", \"method\": \"power_on\", \"inputParams\": {\"a\": \"1234abc\"}}}" -k -X POST https://127.0.0.1:6999/thing/device/service/invoke
# 输出
{"code": 200, "message": "success", "data":{"code":0,"data":{"rtn":"asdfasdf","uid":"111","code":1},"message":"ok"}}
★订阅单个设备事件 getThingEventInfo
接口详情
PATH
/thing/device/event/get
HTTP Method
POST
功能描述
订阅设备事件,注意该接口会保持长连接且不可复用,一旦设备事件上报过来,会在本接口中返回给调用者,且本接口仅支持订阅单个设备的单个事件。
解析方法
本接口会保持长连接,返回消息格式为$Length\r\n\r$content$Length\r\n$content
。首先是消息内容长度的16进制,然后是1个\r\n,最后是消息体。请求参数
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
productKey | String | 产品标识符 | xxx |
deviceName | String | 物的名称 | yyyy |
eventIdentifier | String | 物的事件标识符;非必填,为空返回所有事件; | xxxxx |
正常返回参数实例
{
"code": 200,
"message": "success",
"localizedMsg": "",
"data": {
"items": {
"productKey": string,
"deviceName": string,
"eventCode": "Error",
"iotId": "", //注意,iotId 在边缘端为空。
"eventName": "aaaaa",
"eventType": "info",
"eventBody": {
"ErrorCode": 0
},
"batchId": "", //注意,batchId 在边缘端为空。
"timestamp": 1516342985261
},
"timestamp": 1516343075699
}
}
异常返回参数实例
{
"code": 401,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": { \"productKey\": \"a1VCsnA2il7\", \"deviceName\": \"LedLight2\"}}}" -k -X POST https://127.0.0.1:6999/thing/device/event/get
# 输出
34
{"code": 204, "message": "heartbeats", "data": null}
34
{"code": 204, "message": "heartbeats", "data": null}
151
{"code":200,"localizedMsg":"","data":{"productKey": string, "deviceName": string, "timestamp":"","items":{"iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535201346210}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
34
{"code": 204, "message": "heartbeats", "data": null}
151
{"code":200,"localizedMsg":"","data":{"productKey": string, "deviceName": string, "timestamp":"","items":{"iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535201348211}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
34
{"code": 204, "message": "heartbeats", "data": null}
151
{"code":200,"localizedMsg":"","data":{"productKey": string, "deviceName": string, "timestamp":"","items":{"iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535201350211}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
34
{"code": 204, "message": "heartbeats", "data": null}
151
{"code":200,"localizedMsg":"","data":{"productKey": string, "deviceName": string, "timestamp":"","items":{"iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535201352212}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
订阅多个设备事件 getThingsEventsInfo
接口详情
PATH
/thing/device/events/get
HTTP Method
POST
功能描述
订阅设备事件,注意该接口会保持长连接且不可复用,一旦设备事件上报过来,会在本接口中返回给调用者,本接口支持订阅多个设备的多个事件。
解析方法
本接口会保持长连接,返回消息格式为$Length\r\n\$content$Length\r\n$content
。首先是消息内容长度的16进制,然后是1个\r\n,最后是消息体。请求参数
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
eventInfo | JSON | N/A | 多组请求列表 | 见下面的实例,若此字段为[],则返回所有设备的所有事件。 |
入参实例
[{
"productKey": "aaa",
"deviceName": "bbb",
"eventIdentifier": [//物的事件标识符;非必填,为空返回所有事件;
"aaaa", "bbbb", "ccc"
]
},
{
"productKey": "aaa",
"deviceName": "bbb",
"eventIdentifier": [//物的事件标识符;非必填,为空返回所有事件;
"aaaa", "bbbb", "ccc"
]
},
{
"productKey": "aaa",
"deviceName": "bbb",
"eventIdentifier": [//物的事件标识符;非必填,为空返回所有事件;
"aaaa", "bbbb", "ccc"
]
}
]
正常返回参数实例
{
"code": 200,
"message": "success",
"localizedMsg": "",
"data": {
"items": {
"productKey": string,
"deviceName": string,
"eventCode": "Error",
"iotId": "", //注意,iotId 在边缘端为空。
"eventName": "aaaaa",
"eventType": "info",
"eventBody": {
"ErrorCode": 0
},
"batchId": "", //注意,batchId 在边缘端为空。
"timestamp": 1516342985261
},
"timestamp": 1516343075699
}
}
//注意,考虑到这里是长连接,由server主动推给client,开发者需要关注Http header里面的Transfer-Encoding:chunked字段。
异常返回参数实例
{
"code": 401,
"data": null,
"message": "device not found",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"request\":{ \"apiVer\": \"0.6\"}, \"params\": {\"eventInfo\": [{ \"productKey\": \"a1JJ3QE3CL2\", \"deviceName\": \"1njlnxNbdHs4EmOhnT6c\", \"eventIdentifier\": [\"abc\", \"edf\"]}, { \"productKey\": \"a1JJ3QE3CL2\", \"deviceName\": \"8sQa2kvLKpWitIFFO0M6\", \"eventIdentifier\": [\"abc\", \"edf\"]}]}}" -k -X POST https://127.0.0.1:6999/thing/device/events/get
# 输出
34
{"code": 204, "message": "heartbeats", "data": null}
34
{"code": 204, "message": "heartbeats", "data": null}
151
{"code":200,"localizedMsg":"","data":{"timestamp":"","items":{"productKey": string, "deviceName": string, "iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535206490271}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
151
{"code":200,"localizedMsg":"","data":{"timestamp":"","items":{"productKey": string, "deviceName": string, "iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535206491073}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
151
{"code":200,"localizedMsg":"","data":{"timestamp":"","items":{"productKey": string, "deviceName": string, "iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535206492272}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
151
{"code":200,"localizedMsg":"","data":{"timestamp":"","items":{"productKey": string, "deviceName": string, "iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535206493074}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
151
{"code":200,"localizedMsg":"","data":{"timestamp":"","items":{"productKey": string, "deviceName": string, "iotId":"","eventBody":{"params":{"value":{"timestamp":"88888","markingTime":66666,"designName":"this is design name"},"time":1535206494272}},"eventType":"machinestatuschange","batchId":"","eventName":"machinestatuschange","eventCode":"","timestamp":""}},"message":"success"}
流式计算
获取任务列表
接口详情
参数名称
|
类型
|
默认值
|
参数描述
|
实例
|
PageSize
|
int
|
10
|
一次返回条目的个数, 如果填 0 , 则返回所有。
|
1
|
CurrentPage
|
int
|
1
|
当前页码
|
1
|
SortMethod
|
String
|
TimeDesc
|
排序方式,非必填,默认是"TimeDesc" 时间逆序,可选填:
TimeAsc: 时间正序
NameDesc: 名称逆序
NameAsc: 名称正序
StatusDesc: 状态逆序
StatusAsc: 状态正序
其他值均做默认排序处理。
|
"SortMethod": "TimeDesc""
|
正常返回参数实例
{
"code": 200,
"data": {
"TotalNum": int,
"PageSize": int,
"CurrentPage": int, //从1开始计算
"List": [
//TaskNO: 任务编号, Status: 启/停状态, Name: 规则名称, "Desc": 规则描述, LoadingTime: 加载时间
{"TaskNO": string, "Status": boolean, "Name": string, "Desc": string, "LoadingTime": int},
{"TaskNO": string, "Status": boolean, "Name": string, "Desc": string, "LoadingTime": int},
{"TaskNO": string, "Status": boolean, "Name": string, "Desc": string, "LoadingTime": int},
{"TaskNO": string, "Status": boolean, "Name": string, "Desc": string, "LoadingTime": int}
]
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "no permission",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"PageSize\": 10, \"CurrentPage\": 1, \"SortMethod\": \"TimeDesc\"}}" -k -X POST https://127.0.0.1:6999/streamcompute/task/list-all
# 输出
{"code": 200, "message": "success", "data":{"List":{"Desc":"this is desc 1","Name":"test_task_1","TaskNO":"scc797af791ea64c969b476d1dc663c9d7"},"CurrentPage":1,"TotalNum":1,"PageSize":10}}
新建任务
接口详情
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
Name | string | 任务的名称 | "Name": "工厂" |
Desc | string | 任务描述 | "Desc": "这就是描述" |
正常返回参数实例
{
"message": "success",
"code": 200,
"data": {
"data": {
//logPath: 该任务运行的日志存储路径
"logPath": "/linkedge/run/stream-compute/job_log/sc0cf4683180af491a8a408dd64f346adf",
//createdTime: 单位是毫秒
"createdTime": 1539570530974
//id: 任务唯一标示
"id": "sc0cf4683180af491a8a408dd64f346adf",
"name": "test_task_1",
"description": "this is desc 1"
},
"message": "SUCCESS",
"code": 0,
"TaskNo": "sc0cf4683180af491a8a408dd64f346adf"
}
}
异常返回参数实例
{
"code": 406,
"data": null,
"message": "repeated name",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"Name\": \"test_task_1\", \"Desc\": \"this is desc 1\"}}" -k -X POST https://127.0.0.1:6999/streamcompute/task/add
# 输出
{"code": 200, "message": "success", "data":{"TaskNO":"scc797af791ea64c969b476d1dc663c9d7"}}
删除任务
接口详情
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
TaskNO | int | 任务的编号 | "TaskNO": "a12345" |
正常返回参数实例
{
"code": 200,
"data": {
//TaskNO: 任务编号
"TaskNO": string
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "task is busy now",
"localizedMsg": ""
}
实例
# 输入
# 输出
查看任务
接口详情
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
TaskNO | string | 任务的编号 | "TaskNO": a12345 |
正常返回参数实例
{
"code": 200,
"data": {
//TaskNO: 任务编号, TaskContent: 这里是base64后的Task内容, Status: 是否正在运行
"TaskNO": string,
"TaskContent": string,
"Status": true
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"TaskNO\": \"scc797af791ea64c969b476d1dc663c9d7\"}}" -k -X POST https://127.0.0.1:6999/streamcompute/task/query
# 输出
{"code": 200, "message": "success", "data":{"TaskContent":"77+977+9du+/ve+/ve+/vXNH77+977+977+9H3fvv73vv73vv73NuO+/vXc777+9d++/ve+/ve+/ve+/vSbGlu+/vQU1FO+/ve+/ve+/vdKi77+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+977+90KLvv73vv70XV0bvv73vv70j77+9DmoI77+9a2tQ77+977+977+9NyZWF0ZVRu+/ve+/vVPvv70DIwMT77+977+9A++/ve+/vSNyAxPvv73vv70T77+977+9M3Dvv73vv73vv70277+977+977+9Vu+/vUPvv70O77+977+9fu+/ve+/vT5YWl5L77+977+9WO+/vR5rOu+/ve+/vXjvv71L77+9Hmga77+977+90qLvv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73vv73QoO+/vTcmVhdGUgdGFibvv71SBwcm77+9BlcnR++/vQLvv73vv70CAgIG77+9Nu+/ve+/vQdmFyY277+9FyLvv73vv70CAgIGdu+/vUQ3JlYXRlIGFzIHRu+/ve+/vUbvv73vv71XN0YW77+9Au+/vTYXN0Lvv73vv70277+977+977+9Zhbvv71WUu+/ve+/vTbvv73vv73vv70CckLvv71277+9RDcmVhdGUnLvv70GFzIGJu+/vXbvv73vv71C77+977+977+977+9AgICBkZXZu+/vTZU77+9Fu+/vVIGFzIG77+9Nu+/ve+/ve+/vWYW77+9VlLvv73vv70277+977+977+9AnJC77+9Rldm77+9NlTvv70W77+9UnLvv73vv73vv70CAgIHBybvv71HVjdE77+9V++/vQYXMgbvv70277+977+977+9Zhbvv71WUu+/ve+/vTbvv73vv73vv70CckLvv70HJu+/vUdWN0Tvv71X77+9cu+/ve+/ve+/vQICAgdHMgYXMgdG77+977+9Ru+/ve+/vVc3Rhbvv70C77+9Nhc3Qu+/ve+/vTbvv73vv73vv71mFu+/vVZS77+977+9Nu+/ve+/ve+/vQJyQu+/vUZW77+9Mu+/vUZW77+9BlcmF0dXJlLvv71G77+977+9UnLvv70GFzIGJu+/vXbvv73vv71C77+977+977+977+9AgICB0ZW77+9BlcmF0dXJlIGFzIGNhc3Qu+/ve+/vTbvv73vv73vv71mFu+/vVZS77+977+9Nu+/ve+/ve+/vQJyQu+/vUZW77+9Mu+/vUZW77+9BlcmF0dXJlLvv71mFu+/vVZScu+/vQYXMgbvv73vv71C77+977+977+9AgICBXQVRFUk77+9FSTvv70Hdu+/vQRk77+9IgdHMgYXMgd277+9Ru+/ve+/vWZnNldC77+9RzLvv70DIwMDAu+/ve+/ve+/vQd277+9Ru+/vQLvv73vv70CAgIHR++/vQZSA++/vQJ2VkZ2Vu+/vVYicO+/ve+/ve+/ve+/ve+/vTcmVhdGUgdGFibvv71SBwcm77+977+9Re+/vTbvv73vv70C77+977+9AgICBwcm77+9R1Y3RO+/vVfvv70HZhcmNu+/vRci77+977+9AgICBkZXZu+/vTZU77+9Fu+/vVIHZhcmNu+/vRci77+977+9AgICB0cyB0bvv73vv71XN0YW77+9Au+/ve+/vQICAgdGVu+/vQZXJhdHVyZSBu+/ve+/vUDvv73vv70Hdu+/vUbvv70C77+977+9AgICB0fvv70GUgPvv70Cdwcm77+977+9QnDvv73vv73vv73vv73vv73vv73vv702VydCBu+/ve+/vUbvv70HBybvv73vv71F77+9Nu+/veawpzZW77+9VjdCBwcm77+9R1Y3RO+/vVfvv73vv70GRldm77+9NlTvv70W77+9Uu+/vQdHMu+/vQdGVu+/vQZXJhdHVyZQ77+9Zybvv73vv70HBybvv70GVydH77+977+9du+/vVcmUgdGVu+/vQZXJhdHVyZSA++/vQMj","TaskNO":"scc797af791ea64c969b476d1dc663c9d7"}}
更新任务
接口详情
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
TaskNO | string | 任务的编号 | "TaskNO": "a1234" |
TaskContent | string | 任务的内容base64值 |
正常返回参数实例
{
"code": 200,
"data": {
//TaskNO: 任务编号
"TaskNO": string,
"CheckResult": string
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"TaskNO\": \"scc797af791ea64c969b476d1dc663c9d7\", \"TaskContent\": \"sc521d31c0f99f4fd9b9582463c783ec67LS1CbGluayBTUUwKLS0qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi0tCi0tQXV0aG9yOiDmoI7mtrUKLS1DcmVhdGVUaW1lOiAyMDE4LTA4LTI3IDE5OjE4OjM3Ci0tQ29tbWVudDog6K+36L6T5YWl5Lia5Yqh5rOo6YeK5L+h5oGvCi0tKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiotLQoKY3JlYXRlIHRhYmxlIHByb3BlcnR5ICgKICAgIGpzb24gdmFyY2hhciwKICAgIGdtdENyZWF0ZSBhcyB0b190aW1lc3RhbXAoY2FzdChqc29uX3ZhbHVlKGpzb24sICckLmdtdENyZWF0ZScpIGFzIGJpZ2ludCkpLAogICAgZGV2aWNlTmFtZSBhcyBqc29uX3ZhbHVlKGpzb24sICckLmRldmljZU5hbWUnKSwKICAgIHByb2R1Y3RLZXkgYXMganNvbl92YWx1ZShqc29uLCAnJC5wcm9kdWN0S2V5JyksCiAgICB0cyBhcyB0b190aW1lc3RhbXAoY2FzdChqc29uX3ZhbHVlKGpzb24sICckLml0ZW1zLnRlbXBlcmF0dXJlLnRpbWUnKSBhcyBiaWdpbnQpKSwKICAgIHRlbXBlcmF0dXJlIGFzIGNhc3QoanNvbl92YWx1ZShqc29uLCAnJC5pdGVtcy50ZW1wZXJhdHVyZS52YWx1ZScpIGFzIGludCksCiAgICBXQVRFUk1BUksgd2sgRk9SIHRzIGFzIHdpdGhPZmZzZXQodHMsIDIwMDApCikgd2l0aCAoCiAgICB0eXBlID0gJ2VkZ2VodWInCik7CgpjcmVhdGUgdGFibGUgcHJpbnRfc2luayAoCiAgICBwcm9kdWN0S2V5IHZhcmNoYXIsCiAgICBkZXZpY2VOYW1lIHZhcmNoYXIsCiAgICB0cyB0aW1lc3RhbXAsCiAgICB0ZW1wZXJhdHVyZSBpbnQKKSB3aXRoICgKICAgIHR5cGUgPSAncHJpbnQnCik7CgppbnNlcnQgaW50byBwcmludF9zaW5rCnNlbGVjdCBwcm9kdWN0S2V5LCBkZXZpY2VOYW1lLCB0cywgdGVtcGVyYXR1cmUKZnJvbSBwcm9wZXJ0eQp3aGVyZSB0ZW1wZXJhdHVyZSA+IDIw\"}}" -k -X POST https://127.0.0.1:6999/streamcompute/task/update
# 输出
{"message":"{\"code\":101303,\"data\":{},\"message\":\"{\\\"cause\\\":\\\"JOB_CONTENT_FORMAT_ERROR\\\",\\\"action\\\":\\\"Please check your content\\\",\\\"detail\\\":\\\"code:[30015], brief info:[get plan failed], context info:[detail:[com.alibaba.blink.sql.parser.plan.SqlParseException: \\\\n************\\\\nERR_ID:\\\\n PAR-00001\\\\nCAUSE:\\\\n sql parse context error:\\\\n Lexical error at line 1, column 1. Encountered: \\\\\\\"\\\\\\\\ufffd\\\\\\\" (65533), after : \\\\\\\"\\\\\\\"\\\\nACTION:\\\\n please re-check the sql statement according to descriptions above.\\\\n If you need more help, please contact customer support for this.\\\\nDETAIL:\\\\n\\\\n************\\\\n\\\\tat com.alibaba.blink.sql.parser.plan.BlinkPlannerImpl.parseContext(BlinkPlannerImpl.java:155)\\\\n\\\\tat com.alibaba.blink.launcher.util.SqlJobAdapter.parseSqlContext(SqlJobAdapter.java:168)\\\\n\\\\tat com.alibaba.blink.launcher.util.JobBuildHelper.buildSqlJob(JobBuildHelper.java:62)\\\\n\\\\tat com.alibaba.blink.launcher.JobLauncher.runStream(JobLauncher.java:299)\\\\n\\\\tat com.alibaba.blink.launcher.JobLauncher.main(JobLauncher.java:158)\\\\nCaused by: org.apache.calcite.sql.parser.SqlParseException: Lexical error at line 1, column 1. Encountered: \\\\\\\"\\\\\\\\ufffd\\\\\\\" (65533), after : \\\\\\\"\\\\\\\"\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.convertException(BlinkSqlParserImpl.java:360)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.normalizeException(BlinkSqlParserImpl.java:141)\\\\n\\\\tat org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:138)\\\\n\\\\tat org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:163)\\\\n\\\\tat com.alibaba.blink.sql.parser.plan.BlinkPlannerImpl.parseContext(BlinkPlannerImpl.java:133)\\\\n\\\\t... 4 more\\\\nCaused by: com.alibaba.blink.sql.parser.impl.TokenMgrError: Lexical error at line 1, column 1. Encountered: \\\\\\\"\\\\\\\\ufffd\\\\\\\" (65533), after : \\\\\\\"\\\\\\\"\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImplTokenManager.getNextToken(BlinkSqlParserImplTokenManager.java:15381)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_scan_token(BlinkSqlParserImpl.java:23715)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_3R_48(BlinkSqlParserImpl.java:19450)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_3_34(BlinkSqlParserImpl.java:19777)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_2_34(BlinkSqlParserImpl.java:7468)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.SqlStmt(BlinkSqlParserImpl.java:849)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.SqlStmtEof(BlinkSqlParserImpl.java:888)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.parseSqlStmtEof(BlinkSqlParserImpl.java:197)\\\\n\\\\tat org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:131)\\\\n\\\\t... 6 more\\\\n\\\\tat com.aliyun.iot.edge.blink.client.util.Tools.runShellCMD(Tools.java:134)\\\\n\\\\tat com.aliyun.iot.edge.blink.client.tool.BlinkPlanGenerator.getSqlPlan(BlinkPlanGenerator.java:177)\\\\n\\\\tat com.aliyun.iot.edge.blink.client.tool.BlinkPlanGenerator.getPlanInfo(BlinkPlanGenerator.java:81)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.entity.Job.getPlanInfo(Job.java:337)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.entity.Job.saveContent(Job.java:221)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.manager.JobManager.saveJobContent(JobManager.java:221)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.listener.MethodCallListener.jobManagerHandler(MethodCallListener.java:188)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.listener.MethodCallListener.callMethod(MethodCallListener.java:67)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.listener.MethodCallListener.receiveMethodCall(MethodCallListener.java:59)\\\\n\\\\tat com.aliyun.nova.sdk.DbusSDK.handleMethodCall(DbusSDK.java:57)\\\\n\\\\tat com.aliyun.nova.sdk.communicate.handler.DBusCallHandler.execute(DBusCallHandler.java:49)\\\\n\\\\tat com.aliyun.nova.sdk.communicate.handler.DBusCallHandler.execute(DBusCallHandler.java:36)\\\\n\\\\tat com.aliyun.nova.sdk.tassel.BaseTasselDispatcher.dispatcher(BaseTasselDispatcher.java:60)\\\\n\\\\tat com.aliyun.nova.sdk.communicate.dbus.DBusManager.lambda$connectDaemon$2(DBusManager.java:150)\\\\n\\\\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\\\\n\\\\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\\\\n\\\\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\\\\n\\\\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\\\\n\\\\tat java.lang.Thread.run(Thread.java:748)\\\\n]]\\\"}\"}","data":"","code":500}
启动任务
接口详情
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
TaskNO | string | 任务的编号 | "TaskNO": "a12345" |
正常返回参数实例
{
"code": 200,
"data": {
//TaskNO: 任务编号, StartLog: 启动日志
"TaskNO": string,
"StartLog": string
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"TaskNO\": \"scc797af791ea64c969b476d1dc663c9d7\"}}" -k -X POST https://127.0.0.1:6999/streamcompute/task/start
# 输出
{"message":"success","code":200,"data":{"message":"{\"cause\":\"UNABLE_TO_OPERATE_AGAIN\",\"action\":\"Please contact admin\",\"detail\":\"Job has been running, can not start again\"}","code":101314,"data":[]}}
停止任务
接口详情
参数名称 | 类型 | 参数描述 | 实例 |
---|---|---|---|
TaskNO | string | 任务的编号 | "TaskNO": "a12345" |
正常返回参数实例
{
"code": 200,
"data": {
//TaskNO: 任务编号
"TaskNO": string
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"TaskNO\": \"scc797af791ea64c969b476d1dc663c9d7\"}}" -k -X POST https://127.0.0.1:6999/streamcompute/task/stop
# 输出
{"message":"success","code":200,"data":{"data":[],"message":"SUCCESS","code":0,"TaskNo":"sc0210165dbd2942d09e25bf35d01da1e9"}}
查询任务启停日志
接口详情
参数名称 | 类型 | 参数描述 |
---|---|---|
TaskNO | string | 任务的编号 |
StartTime | int | 开始日志的Unix时间戳,毫秒结尾单位,可以为空 |
EndTime | int | 结束日志的Unix时间戳, 毫秒结尾单位,可以为空 |
SearchKey | string | 查询日志的关键字,可以为空 |
PageSize | int | 一次返回条目的个数, 如果填 0 , 则返回所有。 |
CurrentPage | int | 当前页面 |
正常返回参数实例
{
"code": 200,
"data": {
"TotalNum": int,
"PageSize": int,
"CurrentPage": int, //从1开始计算
"List": [
{"timestamp": 12345, "content": "bbbbb"},
{"timestamp": 12345, "content": "bbbbb"}
]
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 400,
"data": null,
"message": "",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"TaskNO\": \"sc6cf49ae751264385af5c6c0bb7125d5e\", \"PageSize\": 10, \"CurrentPage\": 1}}" -k -X POST https://127.0.0.1:6999/streamcompute/task/log/query
# 输出
{
"code": 200,
"message": "success",
"data": {
"List": [{
"timestamp": "2018-09-06 20:48:53.932",
"content": " [MessageLoopThread-1536238026820] INFO Job - START SUCCESS "
}, {
"timestamp": "2018-09-06 20:48:53.932",
"content": " [MessageLoopThread-1536238026820] INFO Job - STOP SUCCESS "
}, {
"timestamp": "2018-09-06 20:48:53.932",
"content": " [MessageLoopThread-1536238026820] INFO Job - START FAILED: { \"code\": 101303, \"message\": \"{\\\"cause\\\":\\\"JOB_CONTENT_FORMAT_ERROR\\\",\\\"action\\\":\\\"Please check your content\\\",\\\"detail\\\":\\\"code:[30015], brief info:[get plan failed], context info:[detail:[com.alibaba.blink.sql.parser.plan.SqlParseException: \\\\n************\\\\nERR_ID:\\\\n PAR-00001\\\\nCAUSE:\\\\n sql parse context error:\\\\n Lexical error at line 1, column 2. Encountered: \<EOF\> after : \\\\\\\"\\\\\\\"\\\\nACTION:\\\\n please re-check the sql statement according to descriptions above.\\\\n If you need more help, please contact customer support for this.\\\\nDETAIL:\\\\n\\\\n************\\\\n\\\\tat com.alibaba.blink.sql.parser.plan.BlinkPlannerImpl.parseContext(BlinkPlannerImpl.java:155)\\\\n\\\\tat com.alibaba.blink.launcher.util.SqlJobAdapter.parseSqlContext(SqlJobAdapter.java:168)\\\\n\\\\tat com.alibaba.blink.launcher.util.JobBuildHelper.buildSqlJob(JobBuildHelper.java:62)\\\\n\\\\tat com.alibaba.blink.launcher.JobLauncher.runStream(JobLauncher.java:299)\\\\n\\\\tat com.alibaba.blink.launcher.JobLauncher.main(JobLauncher.java:158)\\\\nCaused by: org.apache.calcite.sql.parser.SqlParseException: Lexical error at line 1, column 2. Encountered: \<EOF\> after : \\\\\\\"\\\\\\\"\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.convertException(BlinkSqlParserImpl.java:360)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.normalizeException(BlinkSqlParserImpl.java:141)\\\\n\\\\tat org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:138)\\\\n\\\\tat org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:163)\\\\n\\\\tat com.alibaba.blink.sql.parser.plan.BlinkPlannerImpl.parseContext(BlinkPlannerImpl.java:133)\\\\n\\\\t... 4 more\\\\nCaused by: com.alibaba.blink.sql.parser.impl.TokenMgrError: Lexical error at line 1, column 2. Encountered: \<EOF\> after : \\\\\\\"\\\\\\\"\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImplTokenManager.getNextToken(BlinkSqlParserImplTokenManager.java:15381)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_scan_token(BlinkSqlParserImpl.java:23715)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_3R_48(BlinkSqlParserImpl.java:19450)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_3_34(BlinkSqlParserImpl.java:19777)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.jj_2_34(BlinkSqlParserImpl.java:7468)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.SqlStmt(BlinkSqlParserImpl.java:849)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.SqlStmtEof(BlinkSqlParserImpl.java:888)\\\\n\\\\tat com.alibaba.blink.sql.parser.impl.BlinkSqlParserImpl.parseSqlStmtEof(BlinkSqlParserImpl.java:197)\\\\n\\\\tat org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:131)\\\\n\\\\t... 6 mo re\\\\n\\\\tat com.aliyun.iot.edge.blink.client.util.Tools.runShellCMD(Tools.java:134)\\\\n\\\\tat com.aliyun.iot.edge.blink.client.tool.BlinkPlanGenerator.getSqlPlan(BlinkPlanGenerator.java:177)\\\\n\\\\tat com.aliyun.iot.edge.blink.client.tool.BlinkPlanGenerator.getPlanInfo(BlinkPlanGenerator.java:81)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.entity.Job.getPlanInfo(Job.java:330)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.entity.Job.saveContent(Job.java:214)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.manager.JobManager.saveJobContent(JobManager.java:218)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.listener.MethodCallListener.jobManagerHandler(MethodCallListener.java:182)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.listener.MethodCallListener.callMethod(MethodCallListener.java:64)\\\\n\\\\tat com.aliyun.iot.edge.streamcompute.listener.MethodCallListener.receiveMethodCall(MethodCallListener.java:56)\\\\n\\\\tat com.aliyun.nova.sdk.DbusSDK.handleMethodCall(DbusSDK.java:57)\\\\n\\\\tat com.aliyun.nova.sdk.communicate.handler.DBusCallHandler.execute(DBusCallHandler.java:49)\\\\n\\\\tat com.aliyun.nova.sdk.communicate.handler.DBusCallHandler.execute(DBusCallHandler.java:36)\\\\n\\\\tat com.aliyun.nova.sdk.tassel.BaseTasselDispatcher.dispatcher(BaseTasselDispatcher.java:60)\\\\n\\\\tat com.aliyun.nova.sdk.communicate.dbus.DBusManager.lambda$connectDaemon$2(DBusManager.java:150)\\\\n\\\\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\\\\n\\\\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\\\\n\\\\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\\\\n\\\\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\\\\n\\\\tat java.lang.Thread.run(Thread.java:748)\\\\n]]\\\"}\" "
}],
"CurrentPage": 1,
"TotalNum": 5,
"PageSize": 10
}
}
消息路由
获取路由列表
接口详情
参数名称 | 类型 | 默认值 | 参数描述 | 实例 |
---|---|---|---|---|
PageSize | int | 10 | 一次返回条目的个数, 如果填 0 , 则返回所有 | 1 |
CurrentPage | int | 1 | 当前页码 | 1 |
正常返回参数实例
{
"code": 200,
"data": {
"TotalNum": int,
"PageSize": int,
"CurrentPage": int, //从1开始计算
"List": [
{"SourceType": object, "TopicFilter": string, "TargetType": string},
{"SourceType": object, "TopicFilter": string, "TargetType": string},
{"SourceType": object, "TopicFilter": string, "TargetType": string}
]
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "no permission",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"PageSize\": 10, \"CurrentPage\": 1}}" -k -X POST https://127.0.0.1:6999/message_router/rule/list-all
# 输出
{"code": 200, "message": "success", "data":{"List":[{"SourceType":{"type":"device","data":"#"},"TargetType":"iot.edge.StreamCompute.aaaa","TopicFilter":"all"}],"CurrentPage":1,"TotalNum":1,"PageSize":10}}
新增路由
接口详情
参数名称
|
类型
|
参数描述
|
SourceType
|
string
|
消息类型,可选项为:
device: 设备
function: 函数计算
IotHub: 阿里云物联网平台
|
SourceData
|
string
|
如果明确路由具体的某个pk下的某个设备dn, 格式为: /$pk/$dn
如果需要pk下面的所有设备属性/事件则为: /$pk/+
如果需要所有的设备属性/事件则为: #
|
TopicFilter
|
string
|
消息过滤:
可选项为: all 或 property,表示路由设备的事件上报或者属性变更
|
TargetType
|
string
|
消息类型,可选项为: function: 函数计算 IotHub: 阿里云物联网平台 StreamCompute: 流式计算
|
TargetData
|
string
|
如果TargetType为流式计算,则该值为流式计算的任务名.
|
正常返回参数实例
{
"code": 200,
"data": {},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "no permission",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"SourceType\": \"device\", \"SourceData\": \"#\", \"TopicFilter\": \"all\", \"TargetType\": \"StreamCompute\", \"TargetData\": \"aaaa\"}}" -k -X POST https://127.0.0.1:6999/message_router/rule/add
# 输出
{"code": 200, "message": "success", "data":{"success":"ok"}}
删除指定路由表
接口详情
参数名称
|
类型
|
参数描述
|
SourceType
|
string
|
消息类型,可选项为:
device: 设备
function: 函数计算
IotHub: 阿里云物联网平台
|
SourceData
|
string
|
如果明确路由具体的某个pk下的某个设备dn, 格式为: /$pk/$dn
如果需要pk下面的所有设备属性/事件则为: /$pk/+
如果需要所有的设备属性/事件则为: #
|
TopicFilter
|
string
|
消息过滤:
可选项为: all 或 property,表示路由设备的事件上报或者属性变更
|
TargetType
|
string
|
消息类型,可选项为:function: 函数计算IotHub: 阿里云物联网平台StreamCompute: 流式计算
|
TargetData
|
string
|
如果TargetType为流式计算,则该值为流式计算的任务名.
|
正常返回参数实例
{
"code": 200,
"data": {},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "no permission",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"SourceType\": \"device\", \"SourceData\": \"#\", \"TopicFilter\": \"all\", \"TargetType\": \"StreamCompute\", \"TargetData\": \"aaaa\"}}" -k -X POST https://127.0.0.1:6999/message_router/rule/delete
# 输出
{"code": 200, "message": "success", "data":{"success":"ok"}}
文件管理
上传文件
接口详情
PATH
/filemanager/upload
HTTP Method
POST
功能描述
上传指定的文件到网关上按 multipart/form-data 的格式上传文件内容,注意单个文件不能超过10MB
请求参数
参数名称 | 类型 | 参数描述 |
---|---|---|
FileName | string | 文件名称 |
FileMd5 | string | 文件的md5值 |
正常返回参数实例
{
"code": 200,
"data": {
"file_path": string,文件的网关绝对路径
“file_md5”: string, 文件的md5值
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "no permission",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -k -F "data={\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{\"FileName\": \"aaa.exe\", \"FileMd5\": \"3752fc7147013ee3f029457b55a5954e\"}}" -F "filename=@/xxxx/tmp/Release_V1.5_0830/build/bin/sshd_agent;type=image/gif" https://127.0.0.1:6999/filemanager/upload
# 输出
{"code": 200, "message": "success", "data":{"file_path":"/xxxx/tmp/Release_V1.5_0830/build/bin/aaa.exe","file_md5":"3752fc7147013ee3f029457b55a5954e"}}
系统管理
获取串口列表
接口详情
参数名称 | 类型 | 参数描述 |
---|---|---|
正常返回参数实例
{
"code": 200,
"data": {
"List": ["/dev/tty","/dev/tty2","/dev/tty3"]
},
"message": "success",
"localizedMsg": ""
}
异常返回参数实例
{
"code": 403,
"data": null,
"message": "no permission",
"localizedMsg": ""
}
实例
# 输入
curl -b "test_eweb.cookie" -d "{\"id\":111,\"version\":\"1.0\",\"request\":{\"apiVer\":\"0.6\"},\"params\":{}}" -k -X POST https://127.0.0.1:6999/systemmanager/serial/query
# 输出
{"code": 200, "message": "success", "data":{"List":["/dev/tty","/dev/tty2"]}}
触发报警
指定报警ID触发报警
接口详情
POST /gateway/alarm/service/invoke
请求参数
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
alarmId | Integer | 是 | 报警Id,说明:触发的报警ID必须是已经定义了的告警ID,传递了alarmId则level根据之前自定义级别为准。 |
content | String | 否 | 报警信息内容,可选,如果无此字段或此字段为空,则默认显示报警定义的描述。如果设置该字段,则显示该报警内容。 |
请求示例
curl --header "Content-Type: application/json" --request POST --data '{
"request":{"apiVer": "0.6"}, "params": {"alarmId": 101,"content":"this is a test"}}
}' -k -X POST https://127.0.0.1:9999/gateway/alarm/service/invoke
返回参数
无
返回示例
{
"code": 200,
"data": {},
"message": "success"
}
自定义报警触发
接口详情 POST /gateway/alarm/service/triggerAlarm
说明:该接口与invoke接口的区别在于,该接口可以不用传递报警Id,只需传递用户自定义的报警level和报警content。
请求参数
名称
|
类型
|
是否必须
|
描述
|
level
|
Integer
|
是
|
报警级别(0,1,2,3,4)
|
content
|
String
|
是
|
报警信息内容
|
该接口与 /gateway/alarm/service/invoke 接口的区别在于,该接口可以不用传递报警Id,只需传递用户自定义的报警level和报警content。
|
请求示例
curl --header "Content-Type: application/json" --request POST --data '{
"request":{"apiVer": "0.6"}, "params": {"level": 1,"content":"this is a test"}}
}' -k -X POST https://127.0.0.1:9999/gateway/alarm/service/triggerAlarm
错误码描述
返回码(code) | 返回信息 | 描述 |
---|---|---|
200 | Success | 接口调用成功。 |
302 | Move temporarily | URL重定向 |
400 | Bad Request | 1、语义有误,当前请求无法被服务器理解。除非进行修改,否则客户端不应该重复提交这个请求。 2、请求参数有误。 |
401 | Unauthorized | 当前请求需要用户验证。 |
403 | Forbidden | 服务器已经理解请求,但是拒绝执行它。与401响应不同的是,身份验证并不能提供任何帮助,而且这个请求也不应该被重复提交。 |
404 | Not Found | 请求失败,请求所希望得到的资源未被在服务器上发现。 |
405 | Method Not Allowed | 请求行中指定的请求方法不能被用于请求相应的资源。比如POST方法不支持. |
421 | Too Many Connections | 从当前客户端所在的IP地址到服务器的连接数超过了服务器许可的最大范围。通常,这里的IP地址指的是从服务器上看到的客户端地址(比如用户的网关或者代理服务器地址)。 |
500 | Internal Server Error | 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。一般来说,这个问题都会在服务器端的源代码出现错误时出现。 |
503 | Service Unavailable | 由于临时的服务器维护或者过载,服务器当前无法处理请求。 |
20518 | alarm id is not exist | 告警ID不存在 |
20525 | alarm id is repeated | 报警ID重复 |
20526 | alarm id can not be empty | 报警ID不能为空 |
20527 | alarm level can not be empty | 报警级别不能为空 |
20528 | alarm content can not be empty | 报警内容不能为空 |
注:"★"表示和云端兼容的API接口。