Get all recordings using JWT Token using AJAX request

Using this template helps us debug your issues more effectively :slight_smile:

Description
I am trying to get all zoom recordings using JWT token . I am using AJAX Request

Error
Currrently i am getting : URL has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Which App Type (OAuth / Chatbot / JWT / Webhook)?
Knowing the endpoint/s can help us to identify your issue faster. Please link the ones you need help/have a question with.

Which Endpoint/s?
https://api.zoom.us/v2/accounts/me/recordings

How To Reproduce (If applicable)
Steps to reproduce the behavior:
AJAX Request:

$.ajax({
type: “GET”,
url: “https://api.zoom.us/v2/accounts/me/recordings”,
headers: {
“Access-Control-Allow-Origin”: ‘*’,
‘Authorization’: 'Bearer ’ + token,
‘content-type’ : ‘application/json’,
},
dataType: ‘json’,
success: function (result, status, xhr) {
ShowData(result);
},
error: function (xhr, status, error) {
alert(error);
}
});

Am i doing something wrong ?

Hi @dev.bizdesire,

Are you calling our API from your frontend? If so, a CORS error will be expected. Our APIs must be called from your backend. You can then pass the response to your frontend as needed.

Let me know if this helps to clarify,
Will

How can i do it from backend ? Didn’t get your point.

$.ajax({
type: “GET”,
url: “https://api.zoom.us/v2/accounts/me/recordings ”,
headers: {
“Access-Control-Allow-Origin”: ‘*’,
‘Authorization’: 'Bearer ’ + token,
‘content-type’ : ‘application/json’,
},
dataType: ‘json’,
success: function (result, status, xhr) {
ShowData(result);
},
error: function (xhr, status, error) {
alert(error);
}
});

Hi @dev.bizdesire,

You will need to initiate your API request from a backend resource—you won’t be able to call our APIs directly from your browser or frontend.

Here is an example for calling this endpoint in NodeJS (backend JS), using Axios:

var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://api.zoom.us/v2/users/{userId}/recordings',
  headers: { 
    'Authorization': 'Bearer {token}'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Let me know if this helps—thanks!
Will