Acquire a resource ID

Updated

Acquires a resource ID for a cloud recording session.

POST
https://api.sd-rtn.com/v1/apps/{appid}/cloud_recording/acquire

Before starting cloud recording, call this endpoint to get a resource ID. A single resource ID can be used for only one recording session.

Note

  • Call acquire and start requests in pairs.
  • Call start within two seconds of receiving the resource ID. Batch fetching resource IDs followed by batch start requests may cause failures.
  • The resource ID is valid for five minutes and should be used as soon as possible.

Path Parameters

appidstring
Required

The App ID of your project.

  • For web page recording mode, enter the App ID for which the cloud recording service is enabled.
  • For individual and composite recording modes, use the same App ID as the channel to be recorded. Ensure that the cloud recording service has been enabled for this App ID.

Header Parameters

Content-Typestring

application/json.

Request Body

application/json

cnamestring
Required

The channel name.

  • In individual recording and composite recording modes, this is the name of the channel to be recorded.
  • In web page recording mode, this field differentiates the recording process. The string length cannot exceed 1024 bytes.

A unique recording instance is identified by appid, cname, and uid. To record the same channel multiple times, use the same appId and cname but different uid values.

uidstring
Required

The UID used by the cloud recording service in the channel to identify itself. For example, "527841". The value must meet these conditions:

  • In the range from 1 to (2³²−1), and cannot be 0.
  • Must not duplicate any UID already in the channel.
  • Must be an integer value enclosed in quotes; all users in the channel must use integer UIDs.
clientRequestobject
Required
sceneinteger

The use case for the cloud recording resource:

  • 0: Real-time audio and video recording.
  • 1: Web page recording.
resourceExpiredHournumber

The validity period (hours) for calling the cloud recording RESTful API. The countdown starts after the cloud recording service starts and the sid (recording ID) is obtained.

After timeout, you cannot call the query, update, updateLayout, or stop methods.

startParameterobject

Optional start parameters that improve availability and load balancing.

Set this field to improve availability and optimize load balancing.

Note

Values must be valid and consistent with the clientRequest in the subsequent start request body; otherwise the start request returns an error.

excludeResourceIdsarray<string>

The resourceId values of other recording tasks to exclude, so that the new task uses resources from a different region. Used for cross-regional multi-stream recording. See Multi-channel task assurance.

regionstring

Restricts the cloud recording service to a specific region. By default, the service uses the region of the server where the request originates. Once set, the service does not access servers outside this region.

  • "CN": Mainland China.
  • "AP": Asia excluding Mainland China.
  • "EU": Europe.
  • "NA": North America.

When calling start, the region of the third-party cloud storage must match this value.

Response

  • If the returned status code is 200, the request was successful.

  • If the returned status code is not 200, the request failed. See Response status codes for troubleshooting.

Response Body

The request succeeded. If you set startParameter in the request body and its value is invalid, the acquire request can still succeed, but the following start request returns an error.

cnamestring

The name of the channel to be recorded.

The name of the channel being recorded.

uidstring

The UID used by the cloud recording service in the RTC channel.

resourceIdstring

The cloud recording resource ID. Use this to start a cloud recording session. Valid for five minutes; re-request if expired.

Response

See Page load timeout detection.

Response example

{
    "code": 400,
    "reason": "invalid_appid"
  }

Authorization

This endpoint requires authentication.

basicAuth

Request examples

curl --request POST \    --url https://api.sd-rtn.com/v1/apps/{appid}/cloud_recording/acquire \    --header 'Authorization: Basic <credentials>' \    --header 'Content-Type: application/json' \    --data '{    "cname": "<your_channel_name>",    "uid": "527841",    "clientRequest": {      "scene": 0,      "resourceExpiredHour": 24    }  }'

Response example

{  "cname": "string",  "uid": "string",  "resourceId": "string"}