Updated on 2024-04-22 GMT+08:00

Creating a Video Source

Function

This API is used to create a video source.

URI

POST /v2/{project_id}/source

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Maximum: 64

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. For details about how to obtain a user token, see Authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

video_source_name

Yes

String

Video source name. The value can contain only letters, digits, spaces, and the following special characters: .-_(). It cannot start or end with a space.

Minimum: 1

Maximum: 100

access_type

Yes

String

Access type, which can be cloud or edge.

type

Yes

String

Type: obs, vcn, url, restful, and camera

latitude

No

String

Latitude of the video source. The value ranges from -90.00000 to 90.00000.

longitude

No

String

Longitude of the video source. The value ranges from -180.00000 to 180.00000.

video_group_ids

No

Array of strings

IDs of all video source groups. An ID is a string of 4 to 36 characters consisting of only lowercase letters, digits, hyphens (-), and underscores (_).

type_config

Yes

String

XML file of video source configuration information URL format: <type>URL</type> <config> <URL_ADDRESS></URL_ADDRESS> </config> VCN format: <type>VCN</type> <config> <DATA_SOURCE_ID></DATA_SOURCE_ID> <STREAM_TYPE></STREAM_TYPE> <IP></IP> <PORT></PORT> <USER_NAME></USER_NAME> <PASSWORD></PASSWORD> </config> RESTful format: <type>RESTFUL</type> <config> <HTTP_CHECK></HTTP_CHECK> <URL></URL> <RTSP_URL></RTSP_URL> </config> Camera format: <type>CAMERA</type> <config> <EDGE_CAMERA_ID></EDGE_CAMERA_ID> </config>

Maximum: 1024

tag

No

Array of strings

Video source tag. A maximum of four tags can be selected. Only letters, digits, hyphens (-), and underscores (_) are allowed. Minimum length: 1 character Maximum length: 10 characters

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

video_source_id

String

Video source ID

Example Requests

Request body for creating a video source

/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>"
}

Example Responses

Status code: 200

Video source information

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

Status Codes

Status Code

Description

200

Video source information

Error Codes

See Error Codes.