更新时间:2025-11-19 GMT+08:00
分享

创建视频源

功能介绍

创建视频源。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v2/{project_id}/source

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

用户项目ID,获取方法参见获取项目ID和名称

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token,获取方法参见认证鉴权

表3 请求Body参数

参数

是否必选

参数类型

描述

video_source_name

String

视频源名称,只支持中文、英文字母(a-z,A-Z)、数字、特殊字符(空格.-_() ()),不能以空格开头和结尾,长度范围[1,100]。

access_type

String

接入类型。

  • cloud:云上。

  • edge: 边缘。

type

String

类型。

  • ivm

  • restful

  • url

  • vcn

  • obs

  • camera

  • vcn_restful

latitude

String

视频源的地理位置信息,纬度,-90.00000~90.00000。

longitude

String

视频源的地理位置信息,经度,-180.00000~180.00000。

video_group_ids

Array of strings

系统中所有的视频源分组,只能由小写英文字母(a~z)、数字(0~9)、中划线(-)、下划线(_)组成, 长度范围为[4, 36]。

type_config

String

视频源配置信息xml,长度范围[1,1024]。

url形式:

<type_config>
  <url_address></url_address>
</type_config>

vcn形式:

<type_config>
  <data_source_id></data_source_id>
  <stream_type></stream_type>
  <ip></ip>
  <port></port>
  <user_name></user_name>
  <password></password>
</type_config>

restful形式:

<type_config>
  <http_check></http_check>
  <url></url>
  <rtsp_url></rtsp_url>
</type_config>

ivm形式:

<type_config>
  <device_id></device_id>
  <channel_id></channel_id>
</type_config>

obs形式:

<type_config>
  <bucket></bucket>
  <path></path>
</type_config>

camera形式:

<type_config>
  <device_id></device_id>
  <name></name>
</type_config>

vcn_restful形式:

<type_config>
  <data_source_id></data_source_id>
  <stream_type></stream_type>
  <ip></ip>
  <port></port>
  <user_name></user_name>
  <password></password>
  <vcn_protocol>restful</vcn_protocol>
</type_config>

tag

Array of strings

视频源标签,标签最多选择4个,标签内容只能由中文, 英文字母(a~z, A~Z)、数字(0~9)、中划线(-)、下划线(_)组成,长度范围[1,10]。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

video_source_id

String

视频源id。

状态码:400

表5 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误信息描述。

detail

String

错误详情。

params

Array of strings

错误参数列举。

reason

String

错误原因。

advice

String

建议。

状态码:500

表6 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误信息描述。

detail

String

错误详情。

params

Array of strings

错误参数列举。

reason

String

错误原因。

advice

String

建议。

请求示例

创建视频源请求体

/v2/{project_id}/source/sources/{video_source_id}

{
  "video_source_name" : "url_test",
  "access_type" : "cloud",
  "type" : "url",
  "longitude" : "",
  "latitude" : "",
  "tag" : [ ],
  "video_group_ids" : [ ],
  "type_config" : "<type_config>        <url_address>rtsp://12.12.12.12:333</url_address>      </type_config>"
}

响应示例

状态码:200

视频源信息。

{
  "video_source_id" : "xxxxxxx-xxxxxxx-xxxxxxx-xxxxx-xxxxxx"
}

状态码

状态码

描述

200

视频源信息。

400

参数错误。

500

内部错误。

相关文档