Wann Wann Lee
Wann Wann Lee

Reputation: 43

Cloud Recoding RESTful API Error of Agora.io

I would like to implement your Cloud Recoding of Live Broadcasting via RESTful API. I implemented it with NodeJs. Could you please help me why I get an error and how I can fix it?

On the manual, "Status Code 400: The input is in the wrong format." But I do not know what is wrong.

error: null
body: { resourceId: '', code: 400 }

    var plainCredentials = new Buffer.from(agoraCustomerId+":"+agoraCustomerCertificate);
    var base64Credentials = plainCredentials.toString("base64");

    var options = { 
    url: "https://api.agora.io/v1/apps/AGORA_APP_ID/cloud_recording/acquire", 
    method: "POST", 
    headers: { 
        "Authorization": "Basic " + base64Credentials, 
        "Content-type": "application/json;charset=utf-8" 
    }, 
    body:{ 
        "cname": "190724060650293", 
        "uid": "060716332", 
        "clientRequest": {} 
    }
    };

    request.post(options, function (error, response, body) { 
    console.log("error: " + error); 
    console.log("body: ", body);
    });

Upvotes: 4

Views: 3301

Answers (3)

Ray G
Ray G

Reputation: 11

1 - Make sure you have enable agora recording 2- Check the link and send all parameters. https://docs-preprod.agora.io/en/cloud-recording/cloud_recording_webpage_mode?platform=RESTful EX: { "cname": "httpClient463224", "uid": "527841", "clientRequest":{ "resourceExpiredHour": 24, "scene": 1 } } You forgot to put "resourceExpiredHour": 24,"scene": 1

More info:

PHP: you need to put strval function

$body = ["cname"=>strval($cname),"uid" =>strval($uid),"clientRequest" => ["resourceExpiredHour" => 24,"scene" => 1]];

I hope you solve your issue

Upvotes: 1

Alexey Politov
Alexey Politov

Reputation: 11

In my case it was mistake in Region settings . I used AP_NORTHEAST_1 but 10 need be used

Upvotes: 1

Hermes
Hermes

Reputation: 2898

Agora's Cloud Recording is an add-on feature so it's not enabled by default, it needs to be enabled on your account for a specific AppID. The error you may be receiving is because the feature is not enabled on your account.

UPDATE: Enabling Agora.io's Cloud Recording on your project is now available through the Agora.io Dashboard.

To enable Cloud Recording on your project, you’ll need to click into the Products & Usage section of the Agora.io Dashboard and select the Project name from the drop-down in the upper left-hand corner, click the Duration link below Cloud Recording.

Enable Cloud Recording via Agora.io Dashboard

After you click Enable Cloud Recording, you will be prompted to confirm the concurrent channels settings which defaults to 50, but you can contact [email protected] if you need more.

Theres a getting started tutorial that leverages a POSTMAN collection for quick testing.

QuickStart Tutorial: https://medium.com/@hermes_11327/agora-cloud-recording-quickstart-guide-with-postman-demo-c4a6b824e708

Postman Collection: https://documenter.getpostman.com/view/6319646/SVSLr9AM?version=latest

Upvotes: 2

Related Questions