创建设备
更新时间:2023-03-31
接口描述
本接口用于添加EVS设备。
请求(Request)
请求URI
POST /v1/device
请求头域
除公共头域外,无其它特殊头域。
请求体
参数名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
spaceId | Long | 是 | 设备所处空间的空间ID |
deviceName | String | 是 | 设备名称,最大长度256个字符 |
type | String | 是 | 设备类型,可选值:RTMP/GB28181/ONVIF/RTSP/JT808 |
deviceStreamId | String | 否 | 当type=RTMP时必填;该字段即app/stream的拼接,最大长度256个字符 |
description | String | 否 | 设备描述,最大长度512个字符 |
gbConfig | Object | 是 | 国标设置,当type=GB28181时必填 |
+ platform | String | 是 | 设备平台,可选值:IPC/NVR |
+ gbId | String | 是 | 设备国标ID,20位数字编码字符串 |
+ username | String | 是 | 设备用户名 |
+ password | String | 是 | 设备密码 |
recording | Object | 否 | 录制配置 |
+ sameAsSpace | Boolean | 否 | 是否和空间一致,为true时表示和空间保持一致 |
+ enabled | Object | 否 | 是否开启录制 |
+ bucket | String | 否 | 边缘存储bucket |
+ duration | Integer | 否 | 录制单文件时长,单位:秒 |
+ format | String | 否 | 存储格式,可选:MP4、FLV、M3U8 |
+ authEnabled | Boolean | 是 | 录制文件下载地址是否开启鉴权 |
+ authExpire | Integer | 否 | 鉴权URL有效时间,单位:秒 |
thumbnail | Object | 否 | 截图配置 |
+ enabled | Boolean | 是 | 是否开启截图 |
+ bucket | String | 否 | 边缘存储bucket |
+ interval | Integer | 否 | 截图周期,单位:秒 |
+ authEnabled | Boolean | 是 | 截图文件下载地址是否开启鉴权 |
+ authExpire | Integer | 否 | 鉴权URL有效时间,单位:秒 |
gis | Object | 否 | 地理位置配置,当「人员轨迹分析」应用绑定此空间设备时,要求空间下所有设备已设置gis信息 |
+ longitude | Float | 是 | 经度,范围[-180, 180] |
+ latitude | Float | 是 | 经度,范围[-90, 90] |
+ name | String | 是 | 地理位置名称 |
gbProperties | Object | 否 | 协议配置 |
+ sameAsSpace | Boolean | 否 | 是否和空间一致,为true时表示和空间保持一致 |
+ streamType | String | 是 | 流类型。可选值:TCP,UDP, bvcp空间只支持TCP |
onvifConfig | Object | 否 | ONVIF配置,当type=ONVIF时必填 |
+ deviceIp | String | 是 | 设备IP |
+ devicePort | Integer | 是 | 设备端口号 |
+ username | String | 是 | 设备用户名 |
+ password | String | 是 | 设备密码 |
+ onvifUsername | String | 是 | onvif用户名 |
+ onvifPassword | String | 是 | onvif密码 |
+ platform | String | 是 | 设备平台,可选值:IPC/NCR |
rtspConfig | Object | 否 | RTSP配置,当type=RTSP时必填 |
+ username | String | 否 | 设备用户名 |
+ password | String | 否 | 设备密码 |
+ rtspUri | String | 是 | rtsp地址 |
jtDeviceConfig | Object | 否 | JT808配置,当type=JT808时必填 |
+ terminalPhoneNo | String | 是 | 终端手机号,最大长度32个数字 |
+ plateNo | String | 是 | 车牌号,最大长度16个字符 |
watermarkConfig | 否 | Object | 水印配置 |
+ extendsSpace | 是 | Boolean | 是否继承 |
+ watermarkTemplates | 是 | Array | 水印模版列表 |
++ watermarkTemplateId | 是 | Long | 水印模版id |
响应(Response)
响应头域
除公共头域外,无其它特殊头域。
响应体
参数名称 | 类型 | 描述 |
---|---|---|
deviceId | Long | 设备ID |
示例
请求示例
- 创建RTMP设备
Plain Text
1POST /v1/device 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 "spaceId": 1000001,
8 "deviceName": "evs_device_name",
9 "deviceStreamId": "appId/streamId",
10 "type": "RTMP",
11 "description": "evs_device_description",
12 "recording": {
13 "sameAsSpace": true
14 },
15 "thumbnail": {
16 "enabled": false,
17 "bucket": "evs_bucket",
18 "interval": 10,
19 "authEnabled": true,
20 "authExpire": 3600
21 },
22 "watermarkConfig": {
23 "extendsSpace": false
24 "watermarkTemplates": [{
25 "watermarkTemplateId": 1
26 }]
27 },
28}
- 创建GB28181设备
Plain Text
1POST /v1/device 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 "spaceId": 1000001,
8 "deviceName": "evs_device_name",
9 "type": "GB28181",
10 "description": "evs_device_description",
11 "gbConfig": {
12 "platform": "IPC",
13 "manufacturer": "海康",
14 "gbId": "10000012300012300000",
15 "username": "xxxxxx",
16 "password": "xxxxxx"
17 },
18 "recording": {
19 "sameAsSpace": true
20 },
21 "thumbnail": {
22 "sameAsSpace": false,
23 "enabled": true,
24 "bucket": "evs_bucket",
25 "interval": 10,
26 "authEnabled": true,
27 "authExpire": 3600
28 },
29 "gis": {
30 "longitude": 116.2924,
31 "latitude": 39.8649,
32 "name": "北京市丰台区北京西站南路-道路"
33 }
34}
- 创建ONVIF设备
Plain Text
1POST /v1/device 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 "spaceId": 1000001,
8 "deviceName": "evs_device_name",
9 "type": "ONVIF",
10 "description": "evs_device_description",
11 "onvifConfig": {
12 "deviceIp":"119.249.51.196",
13 "devicePort":8883,
14 "platform": "IPC",
15 "username":"admin",
16 "password":"admin",
17 "onvifUsername":"admin",
18 "onvifPassword":"admin"
19 }
20}
- 创建RTSP设备
Plain Text
1POST /v1/device 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 "spaceId": 1000001,
8 "deviceName": "evs_device_name",
9 "type": "RTSP",
10 "description": "evs_device_description",
11 "rtspConfig": {
12 "username":"admin",
13 "password":"admin",
14 "rtspUri":"rtsp://192.168.1.1"
15 }
16}
- 创建JT808设备
Plain Text
1POST /v1/device 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 "spaceId": 1000001,
8 "deviceName": "evs_device_name",
9 "type": "RTSP",
10 "description": "evs_device_description",
11 "jtDeviceConfig": {
12 "terminalPhoneNo":"18821211234",
13 "plateNo":"a0001"
14 }
15}
响应示例
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 "deviceId": 1000001
11}
错误码
错误码(code) | 消息(message) | 描述 | HTTP状态码 |
---|---|---|---|
DeviceOperationNotPermitted | device operation not permitted for space is not running, space id : XXX | 当前空间未就绪,不允许创建设备 | 403 |
RequestArgumentIllegal | create device argument illegal | 创建设备的请求参数不合法 | 400 |
GbConfigAlreadyExist | gb config already exist, gbId : XXX | 创建的国标ID已经存在 | 400 |
DeviceIpAlreadyExist | device ip already exist, device ip : XXX | 创建的ONVIF设备IP已经存在 | 400 |