'response detail error:2,errMsg:post method api body check failed! Agora REST API

const Authorization = `Basic ${Buffer.from(`${config.CUSTOMERID}:${config.CUSTOMER_SECRET}`).toString("base64")}`;
const acquire = await axios.post(`https://api.agora.io/v1/apps/${config.agoraAppId}/cloud_recording/acquire`,{
                          cname: groupId,
                          uid: userId,
                          clientRequest: {
                          },
                        },
                        { headers: { Authorization } }
                      );

Getting the following response when i call agora live streaming cloud recording from nodejs code using axios.

{
 code: 2,
 reason: 'response detail error:2,errMsg:post method api body check failed!'
}


Solution 1:[1]

This means you have been successfully Authorized but you are passing either wrong value or it is not defined in your body or URL. Please check if any variable you are passing is undefined or contains wrong/incomplete value.

Solution 2:[2]

You should pass the header as an object with they Authorization key, in your case:

{
   headers: {'Authorization': "Basic " + Authorization}
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mohsin Sunasara
Solution 2 Ekaansh Arora