批量添加ONVIF设备
更新时间:2022-02-17
接口描述
本接口用于ONVIF探测结束批量添加设备,每次最多添加20个设备。
请求(Request)
请求URI
POST /v1/device/batch
请求头域
除公共头域外,无其它特殊头域。
请求体
公共参数见「创建设备」的请求体参数信息,批量创建为「创建设备」的请求体参数信息组成的list
响应(Response)
响应头域
除公共头域外,无其它特殊头域。
响应体
参数名称 | 类型 | 描述 |
---|---|---|
deviceList | Array | 设备列表 |
+ deviceId | Long | 设备ID |
示例
请求示例
Plain Text
1POST /v1/device/batch HTTP/1.1
2x-bce-date: 2020-03-25T09:28:13Z
3host: evs.bj.baidubce.com
4content-type: application/json
5authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2020-03-25T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
6[
7 {
8 "spaceId": 1000001,
9 "deviceName": "evs_device_name",
10 "type": "ONVIF",
11 "description": "evs_device_description",
12 "onvifConfig": {
13 "deviceIp":"119.249.51.196",
14 "devicePort":8883,
15 "platform": "IPC",
16 "username":"xxxx",
17 "password":"xxxx",
18 "onvifUsername":"xxxx",
19 "onvifPassword":"xxxx"
20 }
21 },
22 {
23 "spaceId": 1000001,
24 "deviceName": "evs_device_name1",
25 "type": "ONVIF",
26 "description": "evs_device_description",
27 "onvifConfig": {
28 "deviceIp":"119.249.51.197",
29 "devicePort":8883,
30 "platform": "IPC",
31 "username":"xxxx",
32 "password":"xxxx",
33 "onvifUsername":"xxxx",
34 "onvifPassword":"xxxx"
35 }
36 }
37]
响应示例
Plain Text
1HTTP/1.1 200 OK
2Transfer-Encoding: chunked
3x-bce-request-id: 012b9747-f13a-4a2c-a488-02b221844dca
4Cache-Control: no-cache
5Server: BWS
6Date: Tue, 24 Mar 202 013:34:07 GMT
7Content-Type: application/json;charset=UTF-8
8
9{
10 "deviceList":[
11 {
12 "deviceId": 1000001
13 }
14 ]
15}
错误码
错误码(code) | 消息(message) | 描述 | HTTP状态码 |
---|---|---|---|
DeviceOperationNotPermitted | device operation not permitted for space is not running, space id : XXX | 当前空间未就绪,不允许创建设备 | 403 |
RequestArgumentIllegal | create device argument illegal | 创建设备的请求参数不合法 | 400 |
DeviceIpAlreadyExist | device ip already exist, device ip : XXX | 创建的ONVIF设备IP已经存在 | 400 |