Server APIs v2
  • Server APIs overview
  • Accessing Server APIs
  • Room signaling
  • Stream mixing
  • Streaming moderation
  • Streaming control
  • CDN recording
  • Server callbacks
  • Return codes
  • API testing
  • FAQ
  • Documentation
  • Server APIs v2
  • CDN recording
  • Start recording streams on CDN

Starts recording streams on CDN

Last updated:2023-08-01 18:43

1 Description

Starts recording specified live streams on CDN.

You can configure your CDN to record all live streams. But when you need to record specific live streams, you can use call this API to do so.

For the server callback triggered when a recorded file is generated, see Recording completed.

Before using this interface, please confirm that the appid you are using has enabled CDN recording service. If it has not been enabled, please go to the Admin Console to enable it, or you can contact ZEGOCLOUD Technical Support to enable it for you.

2 Request method and endpoint

  • Request method: GET
  • Request endpoint: https://rtc-api.zego.im/?Action=StartCDNRecord
  • Transmission protocol: HTTPS
  • Rate limit: 20 requests/second

3 Request parameters

Listed below are the parameters specific to this request and part of the public request parameters. For the complete list of public request parameters, see Server APIs public request parameters.

Parameter Type Required Description
StreamId[]
Array of String
Yes
A list of Stream IDs.
Example: StreamId[]=cdn01&StreamId[]=cdn02
Vendor
String
Yes
The CDN provider.
  • Ws: Wangsu
EndTime
String
Yes
End time of the recording task, a Unix timestamp. Recording end time must be later than the current time and not later than [current time + 24 hours].
  • Note: this parameter only takes effect when the Vendor is [Tencent].
  • 4 Request example

    https://rtc-api.zego.im/?Action=StartCDNRecord
    &StreamId[]=cdn01&StreamId[]=cdn02
    &Vendor=Tencent
    &EndTime=1616415377
    &<Public Request Parameters>

    5 Response parameters

    Parameter Type Description
    Code
    Number
    Return code.
    Message
    String
    Description of the request execution result.
    RequestId
    String
    Request ID.
    Data
    Object
    Returned data.
    Ws
    Object
    Data returned by Ws (when Ws is the CDN provider).
    msg
    String
    Operation result prompt.
    http_code
    Number
    Business operation status.
    trace_id
    String
    Serial number.
    call_time
    String
    The time to initiate the request.
    list
    Array of Object
    A list of processing results for the requested task.
    task
    String
    The format of the recording file.
    id
    String
    Stream ID.
    http_code
    Number
    The operation status of this task, please refer to msg for processing, or contact ZEGOCLOUD technical support.
    msg
    Object
    The operation result prompt for this task.
    persistentId
    String
    The file identifier of the task.

    6 Response example

    {
        "Code":0,
        "Message":"success",
        "Data":{
            "Ws":{// This Key only takes effect when the Vendor is Ws. 
              "call_time": "2022-04-27 14:27:48",
              "http_code": 200,
              "list": [
                  {
                      "http_code": 200,
                      "id": "vega_test",
                      "msg": "success",
                      "persistentId": "2020bc8b648883c64e7e81f03cf72b70b86f",
                      "task": "mp4"
                  }
              ],
              "msg": null,
              "trace_id": "15ccf21b-f3c2-4ee3-aaad-d995393f80cd"
            }
        },
        "RequestId":"4191282558729715911"
    }

    7 Return codes

    Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.

    Return code Description Solution
    0 Request successful. -
    2 Output parameter error. -
    3 The corresponding permission is not enabled. Please contact ZEGOCLOUD Technical Support.
    4 CDN type does not match. Please check the parameter.
    5 Configuration error. Please contact ZEGOCLOUD Technical Support.
    6 Too many attempts. Please try again later.
    7 Authentication failed. Please check the authentication parameter.
    1000 Request failed. Please contact ZEGOCLOUD Technical Support.
    Page Directory