创建空间
更新时间:2023-03-31
接口描述
本接口用于创建EVS空间。
请求(Request)
请求URI
POST /v1/space
请求头域
除公共头域外,无其它特殊头域。
请求体
参数名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
spaceName | String | 是 | 空间名称,最大长度64个字符 |
description | String | 否 | 空间描述,最大长度512个字符 |
type | String | 否 | 空间类型,默认RTMP,可选值:RTMP/GB28181/BVCP/ONVIF/RTSP/JT808 |
evsChargeType | String | 否 | 创建空间的计费类型,默认traffic,可选值:traffic/bandwidth |
domains | Array | 否 | 空间自定义域名 |
+ domain | String | 是 | 自定义域名 |
+ type | String | 是 | 域名类型,推流:UPSTREAM,播放:DOWNSTREAM;GB28181空间无推流域名 |
upstreamAuth | Object | 否 | 推流鉴权;GB28181空间无推流鉴权 |
+ enabled | Boolean | 是 | 是否开启推流鉴权 |
+ key | String | 否 | 鉴权key |
+ expire | Integer | 否 | 鉴权过期时间,单位:秒 |
downstreamAuth | Object | 否 | 播放鉴权 |
+ enabled | Boolean | 是 | 是否开启播放鉴权 |
+ key | String | 否 | 鉴权key |
+ expire | Integer | 否 | 鉴权过期时间,单位:秒 |
recording | Object | 否 | 录制配置 |
+ enabled | Boolean | 是 | 是否开启录制 |
+ duration | Integer | 否 | 录制单文件时长,单位:秒 |
+ format | String | 否 | 存储格式,可选:MP4、FLV、M3U8 |
+ authEnabled | Boolean | 是 | 录制文件下载地址是否开启鉴权 |
+ authExpire | Integer | 否 | 鉴权URL有效时间,单位:秒 |
+ recordType | String | 是 | 录制类型,周期录制:PERIOD,循环定时录制:LOOP_TIMER,指定时间定时录制:SPECIAL_TIMER |
+ effectiveTimes | Array | 否 | 录制时段,支持多个,录制类型为LOOP_TIMER时必填;输入东八区时间,从00:00:00开始,到23:59:59结束,每段间隔最小一小时 |
++ effectiveTimeStart | String | 是 | 录制开始时间,格式”HH: mm:ss” |
++ effectiveTimeEnd | String | 是 | 录制结束时间,格式”HH: mm:ss” |
+ effectiveDates | Array | 否 | 录制指定日期时段,支持多个,录制类型为SPECIAL_TIMER时必填;输入东八区时间,日期选择最大范围为1年,每段间隔最小一小时,最大7天 |
++ effectiveDateStart | String | 是 | 录制开始日期时间,格式”yyyy-MM-dd HH: mm:ss” |
++ effectiveDateEnd | String | 是 | 录制结束日期时间,格式”yyyy-MM-dd HH: mm:ss” |
thumbnail | Object | 否 | 截图配置 |
+ enabled | Boolean | 是 | 是否开启截图 |
+ bucket | String | 否 | 边缘存储bucket |
+ interval | Integer | 否 | 截图周期,单位:秒 |
+ authEnabled | Boolean | 是 | 截图文件下载地址是否开启鉴权 |
+ authExpire | Integer | 否 | 鉴权URL有效时间,单位:秒 |
timeShift | Object | 否 | 时移配置 |
+ enabled | Boolean | 是 | 是否开启时移 |
+ range | Integer | 是 | 时移范围,单位:秒 |
callback | Object | 否 | 通知配置 |
+ enabled | Boolean | 是 | 是否开启通知 |
+ types | Array | 是 | 回调类型列表,支持多个,开启时必填;推流回调:ON_PUBLISH,断流回调:ON_UNPUBLISH,截图回调:ON_SNAPSHOT,录像回调:ON_RECORD,播放回调:ON_PLAY,停播回调:ON_STOP,在线回调:ON_REGISTER,离线回调:ON_UNREGISTER,AI算子回调:ON_BASE_AI |
+ endpoint | String | 是 | 回调地址,开启时必填;支持http/https,https需用户自己检测域名证书链配置是否正确 |
+ authEnabled | Boolean | 否 | 回调是否验证签名,默认不验证false |
+ key | String | 否 | 回调签名key,用于计算token |
gbProperties | Object | 是 | 国标配置,创建RTMP类型空间时可以不填 |
+ inviteImmediate | Boolean | 是 | 立即拉流,默认是。否:只有播放时触发拉流;是:注册后立即拉流 |
+ streamType | String | 是 | 流类型。可选值:TCP,UDP, bvcp空间只支持TCP |
+ codeStream | String | 否 | 码流类型。可选值:MAIN_STREAM,SUB_STREAM, 只有BVCP空间TD_3116B2_16P型号可支持 |
aiConfig | Object | 否 | AI分析配置 |
+ enabled | Boolean | 是 | 是否开启AI分析 |
+ configuration | Array | 否 | AI配置列表 |
++ type | String | 是 | AI检测类型,FACE:人脸, BODY:人体, SMOKE:吸烟检测, ELECTRIC:电动车, ELECTRIC_ELEVATOR:电车入梯,CAR_ATTRIBUTE:车辆属性, CAR_MODEL:车型, CAR_PLATE:车牌,STATIC_HUMAN_TRAFFIC:静态人流量,STATIC_CAR_TRAFFIC:静态车流量, QUALITY_BRIGHT:视频质量亮度检测, QUALITY_COLOR:视频质量偏色检测, QUALITY_COVER:视频质量遮挡检测, QUALITY_BLUR:视频质量模糊检测, QUALITY_NOISE:视频质量噪声检测, QUALITY_MOSAIC:马赛克检测, QUALITY_COVER2:遮挡检测优化版, QUALITY_SHAKE:抖动检测, QUALITY_STRIPE:滚动条纹检测, QUALITY_STATIC:静帧检测, QUALITY_CHANGE:场景变化检测, QUALITY_MOVE:摄像头移动检测 |
++ interval | Integer | 是 | AI截图间隔 |
++ strategy | String | 是 | AI分析结果入库策略,OPTIMAL:最优, FASTEST:最快, REGULAR:定时 |
++ effectiveTimes | Array | 否 | 检测生效时段,支持多个;输入东八区时间,从00:00:00开始,到23:59:59结束,每段间隔最小半小时 |
+++ effectiveTimeStart | String | 是 | 检测生效开始时间,格式"HH:mm:ss" |
+++ effectiveTimeEnd | String | 是 | 检测生效结束时间,格式"HH:mm:ss" |
+ ftpConfig | Object | 否 | Ftp图片流设置 |
++ enabled | Boolean | 是 | 是否开启Ftp图片流 |
++ password | String | 是 | ftp登录password,长度8-32位,支持字符a-zA-Z0-9-_^* |
lifecycle | Object | 否 | 数据存储生命周期配置 |
+ recordLifecycle | Integer | 否 | 录制存储生命周期,默认7天 |
+ thumbnailLifecycle | Integer | 否 | 截图存储生命周期,默认7天 |
+ aiLifecycle | Integer | 否 | AI基础算子检测存储生命周期,默认7天 |
edgeId | Long | 是 | 空间对应的边缘ID |
deviceMode | String | 否 | 设备型号,bvcp空间需要 |
clientSiteBase | Object | 否 | 基础端侧配置,bvcp空间可配置 |
+ preTime | Integer | 是 | 预录时间 0/3/6,单位:秒 |
+ stream | String | 是 | 录制码流,默认MAIN,可选值:MAIN/SUB |
clientSiteRecording | Object | 否 | 录制端侧配置,bvcp空间可配置 |
+ enabled | Boolean | 是 | 是否开启录制 |
+ type | String | 否 | 录制类型,默认TIMING,可选值:TIMING/MOTION |
+ effectiveTimes | Array | 是 | 录制时段,最多设置10段 |
++ effectiveTimeStart | String | 是 | 录制开始时间,格式"HH: mm" |
++ effectiveTimeEnd | String | 是 | 录制结束时间,格式"HH: mm" |
clientSiteThumbnail | Object | 否 | 截图端侧配置,bvcp空间可配置 |
+ enabled | Boolean | 是 | 是否开启截图配置 |
+ interval | Integer | 是 | 截图间隔,单位:秒,最大3600秒 |
clientSiteAi | Object | 否 | AI端侧配置,bvcp空间可配置 |
+ enabled | Boolean | 是 | 是否开启AI配置 |
+ configuration | Array | 否 | AI配置列表 |
++ type | String | 是 | AI检测类型,ELECTRIC_ELEVATOR |
++ target | Array | 是 | 检测对象 |
+++ targetType | String | 是 | 检测对象类型,可选值:MOTOR, ELE_MOTOR, ELE_BICYCLE, BICYCLE, CHILD_BICYCLE, WHEELBARROW, SCOOTER, ELE_SCOOTER, ELE_TRICYCLE |
+++ confidence | Double | 是 | 置信度,0-1 |
++ effectiveTimes | Array | 是 | 检测生效时段,支持多个;输入东八区时间,从00:00开始,到23:59结束,每段间隔最小半小时 |
+++ effectiveTimeStart | String | 是 | 检测生效开始时间,格式"HH: mm" |
+++ effectiveTimeEnd | String | 是 | 检测生效结束时间,格式"HH: mm" |
++ alarmOut | Object | 否 | 报警方式 |
+++ whiteLight | Boolean | 是 | 闪光报警 |
+++ trigger | Boolean | 是 | 阻梯信号报警 |
+++ audio | Boolean | 是 | 声音报警 |
+++ audioConfig | Object | 否 | 声音报警配置 |
++++ alarmName | String | 是 | 警戒声音名称,最大长度128字符 |
++++ audioId | String | 否 | 警戒音id, 自定义警戒音传 |
++++ times | Integer | 是 | 报警次数,最大50次 |
++ event | Object | 否 | 触发事件 |
+++ recordEvent | Object | 否 | 触发事件录像 |
++++ enabled | Boolean | 是 | 是否开启触发事件录像 |
+++ thumbnailEvent | Object | 否 | 触发事件抓图 |
++++ enabled | Boolean | 是 | 是否开启触发事件抓图 |
clientSiteVideo | Object | 否 | 视频端侧配置,bvcp空间可配置 |
+ streamConfigs | Array | 是 | 码流配置 |
++ streamType | String | 是 | 码流类型,主码流:MAIN,子码流:SUB |
++ streamName | String | 是 | 码流名称,最大长度32字符 |
++ resolution | String | 是 | 分辨率,可选值:2592x1520, 2560x1440, 2304x1296, 1920x1080, 1280x720, 704x576, 480x240, 352x288 |
++ maxBitRate | Integer | 是 | 码率,可选值:8192, 6144, 4096, 3072, 2048, 1024, 768, 512, 256, 128 |
++ encodeType | String | 是 | 视频编码,可选值:h264, h265 |
clientSiteOSD | Object | 否 | On-screen Display 菜单端侧配置,bvcp空间可配置 |
+ time | Object | 否 | 时间戳配置 |
++ dateFormat | String | 是 | 时间格式,可选值:YYYY-MM-DD/MM-DD-YYYY/DD-MM-YYYY |
++ x | Integer | 是 | 水印x坐标, 比例值 x 10000, 如 5000表示50% |
++ y | Integer | 是 | 水印y坐标, 比例值 x 10000 |
+ channelName | Object | 否 | 设备名称配置 |
++ name | String | 是 | 设备名称,最大长度18字符 |
++ x | Integer | 是 | 水印x坐标, 比例值 x 10000 |
++ y | Integer | 是 | 水印y坐标, 比例值 x 10000 |
+ customs | Array | 否 | 自定义水印 |
++ value | String | 是 | 水印内容,如有两行使用"\r\n"间隔,最大长度15字符 |
++ x | Integer | 是 | 水印x坐标, 比例值 x 10000 |
++ y | Integer | 是 | 水印y坐标, 比例值 x 10000 |
transcodeForwardConfig | Object | 否 | 转推配置 |
+ enabled | Boolean | 是 | 是否开启 |
+ transcodeTemplateId | Long | 是 | 转码模版id,原始流传-1 |
+ forwardDomain | String | 是 | 转推域名,格式:domain或domain:port或ip:port |
watermarkConfig | Object | 否 | 水印配置 |
+ watermarkTemplates | Array | 是 | 水印模版列表 |
++ watermarkTemplateId | Long | 是 | 水印模版id |
响应(Response)
响应头域
除公共头域外,无其它特殊头域。
响应体
参数名称 | 类型 | 描述 |
---|---|---|
spaceId | Long | 空间ID |
domains | Array | 空间自定义域名 |
+ domain | String | 自定义域名/系统创建域名 |
+ type | String | 域名类型,推流:UPSTREAM,播放:DOWNSTREAM |
+ cname | String | 域名cname |
示例
请求示例
- 创建RTMP空间请求
POST /v1/space 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
{
"spaceName": "evs_space_name",
"description": "evs_space_description",
"evsChargeType": "traffic",
"domains": [
{
"domain": "evs.up.baidu.com",
"type": "UPSTREAM"
},
{
"domain": "evs.down.baidu.com",
"type": "DOWNSTREAM"
}
],
"upstreamAuth": {
"enabled": true,
"key": "evs_upstream_key",
"expire": 3600
},
"downstreamAuth": {
"enabled": true,
"key": "evs_downstream_key",
"expire": 3600
},
"recording": {
"enabled": true,
"bucket": "evs_bucket",
"duration": 600,
"format": "M3U8",
"authEnabled": true,
"authExpire": 3600
},
"thumbnail": {
"enabled": true,
"bucket": "evs_bucket",
"interval": 10,
"authEnabled": true,
"authExpire": 3600
},
"timeShift": {
"enabled": true,
"range": 3600
},
"transcodeForwardConfig": {
"enabled": false,
"transcodeTemplateId": -1
},
"watermarkConfig": {
"watermarkTemplates": [{
"watermarkTemplateId": 1
}]
},
"edgeId": 1
}
- 创建国标空间请求
POST /v1/space 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
{
"spaceName": "gb_space_name",
"description": "gb_space_description",
"type": "GB28181",
"evsChargeType": "traffic",
"domains": [
{
"domain": "down.evs.baidu.com",
"type": "DOWNSTREAM"
}
],
"downstreamAuth": {
"enabled": true,
"key": "evs_downstream_key",
"expire": 3600
},
"recording": {
"enabled": true,
"bucket": "evs_bucket",
"duration": 600,
"format": "M3U8",
"authEnabled": true,
"authExpire": 3600
},
"thumbnail": {
"enabled": true,
"bucket": "evs_bucket",
"interval": 10,
"authEnabled": true,
"authExpire": 3600
},
"timeShift": {
"enabled": true,
"range": 3600
},
"callback": {
"enabled": true,
"types": [
"ON_PUBLISH",
"ON_UNPUBLISH",
"ON_SNAPSHOT"
],
"endpoint": "http://example.evslive.com/space/1000001?callback",
"authEnabled": true,
"key": "zLDFWPdHLFU9oOhiX69jH6EXdJ5fDnZG"
},
"gbProperties": {
"inviteImmediate": true
},
"edgeId": 1
}
- 创建bvcp空间请求
POST /v1/space 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
{
"spaceName": "bvcp_space_name",
"description": "bvcp_space_description",
"type": "BVCP",
"evsChargeType": "traffic",
"deviceMode": "TD_9555A3",
"domains": [
{
"domain": "down.evs.baidu.com",
"type": "DOWNSTREAM"
}
],
"downstreamAuth": {
"enabled": true,
"key": "evs_downstream_key",
"expire": 3600
},
"callback": {
"enabled": true,
"types": [
"ON_PUBLISH",
"ON_UNPUBLISH",
"ON_SNAPSHOT"
],
"endpoint": "http://example.evslive.com/space/1000001?callback",
"authEnabled": true,
"key": "zLDFWPdHLFU9oOhiX69jH6EXdJ5fDnZG"
},
"gbProperties": {
"inviteImmediate": true,
"streamType": "TCP"
},
"edgeId": 1,
"lifecycle":{
"recordLifecycle":7,
"thumbnailLifecycle":7,
"aiLifecycle":7
},
"clientSiteBase":{
"preTime":6,
"stream":"SUB"
},
"clientSiteRecording":{
"enabled":true,
"type":"TIMING",
"effectiveTimes":[
{
"effectiveTimeStart":"00:01",
"effectiveTimeEnd":"23:01"
}
]
},
"clientSiteThumbnail":{
"enabled":true,
"interval":8
},
"clientSiteVideo":{
"streamConfigs":[
{
"streamType":"MAIN",
"streamName":"main_test_0901_001",
"resolution":"1920x1080",
"maxBitRate":3072,
"encodeType":"h264"
},
{
"streamType":"SUB",
"streamName":"sub_test_0901_001",
"resolution":"704x576",
"maxBitRate":1024,
"encodeType":"h264"
}
]
},
"clientSiteOSD":{
"time":{
"dateFormat":"DD-MM-YYYY",
"x":7347,
"y":8843
},
"channelName":{
"name":"ipc",
"x":4146,
"y":6655
},
"customs":[
{
"value":"test",
"x":3982,
"y":4343
},
{
"value":"test1\r\n水印",
"x":541,
"y":3687
}
]
},
"clientSiteAi":{
"enabled":true,
"configuration":[
{
"type":"ELECTRIC_ELEVATOR",
"target":[
{
"targetType":"MOTOR",
"confidence":0.6
},
{
"targetType":"ELE_BICYCLE",
"confidence":0.7
}
],
"effectiveTimes":[
{
"effectiveTimeStart":"12:00",
"effectiveTimeEnd":"12:30"
}
],
"alarmOut":{
"audio":true,
"whiteLight":true,
"trigger":true,
"audioConfig":{
"alarmName":"警戒区",
"times":3
}
},
"event":{
"recordEvent":{
"enabled":true
},
"thumbnailEvent":{
"enabled":true
}
}
}
]
}
}
响应示例
- 创建RTMP空间响应
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
{
"spaceId": 1000001,
"domains": [
{
"domain": "yyy.com",
"type": "DOWNSTREAM",
"cname": "yyy.down.evs.baidu.com"
},
{
"domain": "xxx.com",
"type": "UPSTREAM",
"cname": "xxx.up.evs.baidu.com"
}
]
}
- 创建GB28181空间响应
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
{
"spaceId": 1000001,
"domains": [
{
"domain": "yyy.com",
"type": "DOWNSTREAM",
"cname": "yyy.down.evs.baidu.com"
}
]
}
- 创建BVCP空间响应
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
{
"spaceId": 1000001,
"domains": [
{
"domain": "yyy.com",
"type": "DOWNSTREAM",
"cname": "yyy.down.evs.baidu.com"
}
]
}
错误码
错误码(code) | 消息(message) | 描述 | HTTP状态码 |
---|---|---|---|
SpaceAlreadyExist | space already exist, space name: XXX | 空间名称已经存在 | 400 |