Updated on 2024-09-27 GMT+08:00

Generating a Signed URL

Function

Generates a signed URL.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/auth/chain

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. This parameter is mandatory when token authentication is used. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

domain

Yes

String

Ingest or streaming domain name.

domain_type

Yes

String

Domain name type.

stream

Yes

String

Stream name, which is the same as the StreamName in an ingest or streaming URL.

app

Yes

String

Application name, which is the same as the AppName in an ingest or streaming URL.

check_level

No

Integer

Signing method C is mandatory.

Check level. The value of LiveID consists of AppName and StreamName, that is, <app_name>/<stream_name>.

The options are as follows:

  • 3: The system checks only LiveID but not the validity of the signed URL.

  • 5: The system checks LiveID and the validity of Timestamp.

start_time

No

String

Start time of the valid access time defined by the user, for example, 2006-01-02T15:04:05Z07:00.

If this parameter is not specified or is left empty, the current time is used.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

keychain

Array of strings

Generated signed URLs.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Example Requests

POST /v1/{project_id}/auth/chain

{
  "domain" : "string",
  "domain_type" : "string",
  "stream" : "string",
  "app" : "string",
  "check_level" : 0,
  "start_time" : "string"
}

Example Responses

Status code: 200

Signed URL obtained.

{
  "keychain" : [ "http://pull.domain.com/live/stream.flv?secret=xxx&time=ttt", "rtmp://pull.domain.com/live/stream?secret=xxx&time=ttt" ]
}

Status code: 400

Obtain the signed URL failed.

{
  "error_code" : "LIVE.100011001",
  "error_msg" : "Parameter verification failed."
}

Status Codes

Status Code

Description

200

Signed URL obtained.

400

Obtain the signed URL failed.

Error Codes

See Error Codes.