创建空间
更新时间: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空间请求
Plain Text
1POST /v1/space 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 "spaceName": "evs_space_name",
9 "description": "evs_space_description",
10 "evsChargeType": "traffic",
11 "domains": [
12 {
13 "domain": "evs.up.baidu.com",
14 "type": "UPSTREAM"
15 },
16 {
17 "domain": "evs.down.baidu.com",
18 "type": "DOWNSTREAM"
19 }
20 ],
21 "upstreamAuth": {
22 "enabled": true,
23 "key": "evs_upstream_key",
24 "expire": 3600
25 },
26 "downstreamAuth": {
27 "enabled": true,
28 "key": "evs_downstream_key",
29 "expire": 3600
30 },
31 "recording": {
32 "enabled": true,
33 "bucket": "evs_bucket",
34 "duration": 600,
35 "format": "M3U8",
36 "authEnabled": true,
37 "authExpire": 3600
38 },
39 "thumbnail": {
40 "enabled": true,
41 "bucket": "evs_bucket",
42 "interval": 10,
43 "authEnabled": true,
44 "authExpire": 3600
45 },
46 "timeShift": {
47 "enabled": true,
48 "range": 3600
49 },
50 "transcodeForwardConfig": {
51 "enabled": false,
52 "transcodeTemplateId": -1
53 },
54 "watermarkConfig": {
55 "watermarkTemplates": [{
56 "watermarkTemplateId": 1
57 }]
58 },
59 "edgeId": 1
60}
- 创建国标空间请求
Plain Text
1POST /v1/space 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 "spaceName": "gb_space_name",
8 "description": "gb_space_description",
9 "type": "GB28181",
10 "evsChargeType": "traffic",
11 "domains": [
12 {
13 "domain": "down.evs.baidu.com",
14 "type": "DOWNSTREAM"
15 }
16 ],
17 "downstreamAuth": {
18 "enabled": true,
19 "key": "evs_downstream_key",
20 "expire": 3600
21 },
22 "recording": {
23 "enabled": true,
24 "bucket": "evs_bucket",
25 "duration": 600,
26 "format": "M3U8",
27 "authEnabled": true,
28 "authExpire": 3600
29 },
30 "thumbnail": {
31 "enabled": true,
32 "bucket": "evs_bucket",
33 "interval": 10,
34 "authEnabled": true,
35 "authExpire": 3600
36 },
37 "timeShift": {
38 "enabled": true,
39 "range": 3600
40 },
41 "callback": {
42 "enabled": true,
43 "types": [
44 "ON_PUBLISH",
45 "ON_UNPUBLISH",
46 "ON_SNAPSHOT"
47 ],
48 "endpoint": "http://example.evslive.com/space/1000001?callback",
49 "authEnabled": true,
50 "key": "zLDFWPdHLFU9oOhiX69jH6EXdJ5fDnZG"
51 },
52 "gbProperties": {
53 "inviteImmediate": true
54 },
55 "edgeId": 1
56}
- 创建bvcp空间请求
Plain Text
1POST /v1/space 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 "spaceName": "bvcp_space_name",
8 "description": "bvcp_space_description",
9 "type": "BVCP",
10 "evsChargeType": "traffic",
11 "deviceMode": "TD_9555A3",
12 "domains": [
13 {
14 "domain": "down.evs.baidu.com",
15 "type": "DOWNSTREAM"
16 }
17 ],
18 "downstreamAuth": {
19 "enabled": true,
20 "key": "evs_downstream_key",
21 "expire": 3600
22 },
23 "callback": {
24 "enabled": true,
25 "types": [
26 "ON_PUBLISH",
27 "ON_UNPUBLISH",
28 "ON_SNAPSHOT"
29 ],
30 "endpoint": "http://example.evslive.com/space/1000001?callback",
31 "authEnabled": true,
32 "key": "zLDFWPdHLFU9oOhiX69jH6EXdJ5fDnZG"
33 },
34 "gbProperties": {
35 "inviteImmediate": true,
36 "streamType": "TCP"
37 },
38 "edgeId": 1,
39 "lifecycle":{
40 "recordLifecycle":7,
41 "thumbnailLifecycle":7,
42 "aiLifecycle":7
43 },
44 "clientSiteBase":{
45 "preTime":6,
46 "stream":"SUB"
47 },
48 "clientSiteRecording":{
49 "enabled":true,
50 "type":"TIMING",
51 "effectiveTimes":[
52 {
53 "effectiveTimeStart":"00:01",
54 "effectiveTimeEnd":"23:01"
55 }
56 ]
57 },
58 "clientSiteThumbnail":{
59 "enabled":true,
60 "interval":8
61 },
62 "clientSiteVideo":{
63 "streamConfigs":[
64 {
65 "streamType":"MAIN",
66 "streamName":"main_test_0901_001",
67 "resolution":"1920x1080",
68 "maxBitRate":3072,
69 "encodeType":"h264"
70 },
71 {
72 "streamType":"SUB",
73 "streamName":"sub_test_0901_001",
74 "resolution":"704x576",
75 "maxBitRate":1024,
76 "encodeType":"h264"
77 }
78 ]
79 },
80 "clientSiteOSD":{
81 "time":{
82 "dateFormat":"DD-MM-YYYY",
83 "x":7347,
84 "y":8843
85 },
86 "channelName":{
87 "name":"ipc",
88 "x":4146,
89 "y":6655
90 },
91 "customs":[
92 {
93 "value":"test",
94 "x":3982,
95 "y":4343
96 },
97 {
98 "value":"test1\r\n水印",
99 "x":541,
100 "y":3687
101 }
102 ]
103 },
104 "clientSiteAi":{
105 "enabled":true,
106 "configuration":[
107 {
108 "type":"ELECTRIC_ELEVATOR",
109 "target":[
110 {
111 "targetType":"MOTOR",
112 "confidence":0.6
113 },
114 {
115 "targetType":"ELE_BICYCLE",
116 "confidence":0.7
117 }
118 ],
119 "effectiveTimes":[
120 {
121 "effectiveTimeStart":"12:00",
122 "effectiveTimeEnd":"12:30"
123 }
124 ],
125 "alarmOut":{
126 "audio":true,
127 "whiteLight":true,
128 "trigger":true,
129 "audioConfig":{
130 "alarmName":"警戒区",
131 "times":3
132 }
133 },
134 "event":{
135 "recordEvent":{
136 "enabled":true
137 },
138 "thumbnailEvent":{
139 "enabled":true
140 }
141 }
142 }
143 ]
144 }
145}
响应示例
- 创建RTMP空间响应
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 "spaceId": 1000001,
10 "domains": [
11 {
12 "domain": "yyy.com",
13 "type": "DOWNSTREAM",
14 "cname": "yyy.down.evs.baidu.com"
15 },
16 {
17 "domain": "xxx.com",
18 "type": "UPSTREAM",
19 "cname": "xxx.up.evs.baidu.com"
20 }
21 ]
22}
- 创建GB28181空间响应
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 "spaceId": 1000001,
10 "domains": [
11 {
12 "domain": "yyy.com",
13 "type": "DOWNSTREAM",
14 "cname": "yyy.down.evs.baidu.com"
15 }
16 ]
17}
- 创建BVCP空间响应
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 "spaceId": 1000001,
10 "domains": [
11 {
12 "domain": "yyy.com",
13 "type": "DOWNSTREAM",
14 "cname": "yyy.down.evs.baidu.com"
15 }
16 ]
17}
错误码
错误码(code) | 消息(message) | 描述 | HTTP状态码 |
---|---|---|---|
SpaceAlreadyExist | space already exist, space name: XXX | 空间名称已经存在 | 400 |