创建设备
更新时间: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设备
POST /v1/device HTTP/1.1
x-bce-date: 2020-03-25T09:28:13Z
host: evs.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2020-03-25T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
{
"spaceId": 1000001,
"deviceName": "evs_device_name",
"deviceStreamId": "appId/streamId",
"type": "RTMP",
"description": "evs_device_description",
"recording": {
"sameAsSpace": true
},
"thumbnail": {
"enabled": false,
"bucket": "evs_bucket",
"interval": 10,
"authEnabled": true,
"authExpire": 3600
},
"watermarkConfig": {
"extendsSpace": false
"watermarkTemplates": [{
"watermarkTemplateId": 1
}]
},
}
- 创建GB28181设备
POST /v1/device HTTP/1.1
x-bce-date: 2020-03-25T09:28:13Z
host: evs.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2020-03-25T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
{
"spaceId": 1000001,
"deviceName": "evs_device_name",
"type": "GB28181",
"description": "evs_device_description",
"gbConfig": {
"platform": "IPC",
"manufacturer": "海康",
"gbId": "10000012300012300000",
"username": "xxxxxx",
"password": "xxxxxx"
},
"recording": {
"sameAsSpace": true
},
"thumbnail": {
"sameAsSpace": false,
"enabled": true,
"bucket": "evs_bucket",
"interval": 10,
"authEnabled": true,
"authExpire": 3600
},
"gis": {
"longitude": 116.2924,
"latitude": 39.8649,
"name": "北京市丰台区北京西站南路-道路"
}
}
- 创建ONVIF设备
POST /v1/device HTTP/1.1
x-bce-date: 2020-03-25T09:28:13Z
host: evs.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2020-03-25T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
{
"spaceId": 1000001,
"deviceName": "evs_device_name",
"type": "ONVIF",
"description": "evs_device_description",
"onvifConfig": {
"deviceIp":"119.249.51.196",
"devicePort":8883,
"platform": "IPC",
"username":"admin",
"password":"admin",
"onvifUsername":"admin",
"onvifPassword":"admin"
}
}
- 创建RTSP设备
POST /v1/device HTTP/1.1
x-bce-date: 2020-03-25T09:28:13Z
host: evs.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2020-03-25T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
{
"spaceId": 1000001,
"deviceName": "evs_device_name",
"type": "RTSP",
"description": "evs_device_description",
"rtspConfig": {
"username":"admin",
"password":"admin",
"rtspUri":"rtsp://192.168.1.1"
}
}
- 创建JT808设备
POST /v1/device HTTP/1.1
x-bce-date: 2020-03-25T09:28:13Z
host: evs.bj.baidubce.com
content-type: application/json
authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2020-03-25T09:28:13Z/1800/content-type;host;x-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
{
"spaceId": 1000001,
"deviceName": "evs_device_name",
"type": "RTSP",
"description": "evs_device_description",
"jtDeviceConfig": {
"terminalPhoneNo":"18821211234",
"plateNo":"a0001"
}
}
响应示例
HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 012b9747-f13a-4a2c-a488-02b221844dca
Cache-Control: no-cache
Server: BWS
Date: Tue, 24 Mar 202 013:34:07 GMT
Content-Type: application/json;charset=UTF-8
{
"deviceId": 1000001
}
错误码
错误码(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 |