Skip to main content

Read All Image URLs Using JQuery



  • Roee Ben Ari

    Hi Graham, thanks for reaching out. 

    Regarding the error you see, did you make sure to replace the "cloudName" part of the request URL with your own cloud name (you can see it in

    For example, if your cloud name is "graham" then the URL should be:

    in addition, the request should be done using "GET" rather than "POST".

    Finally, the API uses basic auth so you should pass your credentials with something like this:

    beforeSend: function (xhr) {
    xhr.setRequestHeader ("Authorization", "Basic " + btoa(apiKey + ":" + secret));

    The more important issue though is that you shouldn't perform such a request on the client side as it will expose your cloud's secret which is definitely something you should keep safe.
    As the API to retrieve resources data is part of the Cloudinary Admin API it would allow anyone who obtains your API key and secret to perform all actions on your account. This kind of operation should be done on your own server rather than on the client in order to protect your account.

  • Graham Roy

    Hi Roee.


    Thanks for your reply. I did include the cloudname in the url and I have made the changes you suggested but it still doesn't work.

    Here is my function:

    function updatePhotoAlbum(){
      var url = "";
          beforeSend: function(request){
          var API_KEY = "apikey";
          var API_SECRET = "apisecret";
          request.setRequestHeader("Authorization","Basic" + btoa(API_KEY + ":" + API_SECRET));
          url: url,
          success: function(response){

    but I still get an error:

    Failed to load resource: the server responded with a status of 404 (Not Found)


    in the console. When I click the link it refers to go I go the resources json



  • Roee Ben Ari

    Hi Graham,

    It looks like the request is blocked because our server doesn't allow cross-domain requests on the API for security reasons. 
    This ties to the second part of the answer given above. You shouldn't be doing this kind of request in the browser - as it also seems to be not only non-recommended but impossible.


Post is closed for comments.