Help Center/ SparkRTC/ API Reference/ Examples/ Application callback management/ Configuring a Recording Event Callback
Updated on 2022-10-08 GMT+08:00

Configuring a Recording Event Callback

Function

Configures a recording event callback.

When a subscribed event occurs in a task, the callback address configured through this API is used to receive a notification.

For details about the callback content, see Value-added (Recording) Event Callback Notification Content.

URI

PUT /v2/apps/{app_id}/record-callback

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

app_id

Yes

String

Application ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Content type.

X-Auth-Token

No

String

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

Authorization

No

String

Authentication information. This parameter is mandatory when AK/SK-based authentication is used.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory when AK/SK-based authentication is used.

X-Project-Id

No

String

Project ID. This parameter is mandatory when AK/SK-based authentication is used.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

url

Yes

String

Callback notification URL, which must start with http:// or https:// and support POST.

auth_key

No

String

Callback key, which is used for authentication.

Response Parameters

Status code: 200

Table 4 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 5 Response body parameters

Parameter

Type

Description

app_id

String

Application ID.

record_callback

AppCallbackUrl object

Callback information.

Table 6 AppCallbackUrl

Parameter

Type

Description

url

String

Callback notification URL, which must start with http:// or https:// and support POST.

auth_key

String

Callback key, which is used for authentication. If this parameter is not set or left empty, the authentication header field will not be added to the callback.

notify_event_subscription

Array of strings

Cloud recording notification subscription message.

The options are as follows:

  • RECORD_NEW_FILE_START: Recording started.

  • RECORD_FILE_COMPLETE: Recording file generated.

update_time

String

Update time, for example, 2006-01-02T15:04:05.075Z. The time zone is UTC.

Status code: 400

Table 7 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Status code: 404

Table 9 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Status code: 500

Table 11 Response header parameters

Parameter

Type

Description

X-request-Id

String

Request ID for task tracing.

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Description.

Example Requests

PUT https://rtc-api.myhuaweicloud.com/v2/apps/{app_id}/record-callback

{
  "url" : "http://mydomain.com/callback",
  "auth_key" : "8923ab8c2dcef4538923ab8c2dcef453"
}

Example Responses

Status code: 200

The configuration is successful.

{
  "app_id" : "123456789abcdefghijklmno",
  "record_callback" : {
    "url" : "http://mydomain.com",
    "auth_key" : "78912374ae8cdb38",
    "notify_event_subscription" : [ "RECORD_NEW_FILE_START", "RECORD_FILE_COMPLETE", "RTC_USER_ROLE_CHANGED", "RTC_AUDIO_STREAM_OPEN", "RTC_AUDIO_STREAM_CLOSE", "RTC_VIDEO_STREAM_OPEN", "RTC_VIDEO_STREAM_CLOSE" ],
    "update_time" : "2020-07-26T07:53:05.075Z"
  }
}

Status code: 400

Configuration failed because the request cannot be understood by the server or parameters are incorrect.

{
  "error_code" : "RTC.00001003",
  "error_msg" : "InvalidParameterValue"
}

Status code: 404

Configuration failed because the application does not exist.

{
  "error_code" : "RTC.00001003",
  "error_msg" : "InvalidParameterValue"
}

Status code: 500

Configuration failed due to server error.

{
  "error_code" : "RTC.00002xxx",
  "error_msg" : "InternalError"
}

Status Codes

Status Code

Description

200

The configuration is successful.

400

Configuration failed because the request cannot be understood by the server or parameters are incorrect.

404

Configuration failed because the application does not exist.

500

Configuration failed due to server error.

Error Codes

See Error Codes.