Skip to main content

How can I list all of my existing folders and subfolders?

Comments

10 comments

  • Michael Hodson

    So, I'm trying to test this using the direct API as per the example above.

    For the signature hash, since there are no other parameters:

    timestamp=1529697857abcd (abcd is the api_secret value)

    I generate the hash and add it to call

    https://api.cloudinary.com/v1_1/my_cloud_name/folders?api_key=1234&timestamp=1529697857&signature=4b569a0f8322b3a285296b3b8c2908c2a1cb1937

    A dialog pops up "Authentication Required" / User Name: / Password: / OK

    Clear the dialog and JSON return says:

    {"error":{"message":"Invalid credentials"}}

    What am I missing?

     

     

     

     

    0
  • Aditi Madan

    Hi Michael,

    What was the  Username/Password you provided in the dialog box? Username here should be the API key and password should be the API secret.

    Thanks,
    Aditi

    0
  • Jim Klymus

    Why is something as simple as listing the names of the files and folders soooo 1980's-ish?? You have to use something so cumbersome as an API just to LIST the filenames and folders of your media assets? And isn't there some limit to the max number of results you can get back? Something like 500 or so?

    Why is it impossible to put this functionality in the main user interface? Nice and simple.

    0
  • Victor Li

    Hi Jim,

    I do see your point here! I've opened up a feature request for this, and our internal team will evaluate it against their other projects and we will update you if or when there is going to be an implementation of this.

    Thanks,
    Victor

    1
  • M.Albiero

    Hello,

    I tried the tutorial above and all I can do is get a list of first level folders only.

    I want to list all the folders and corresponding subfolders with a single API call.

    Is it possible?

    Thank you

    1
  • Erwin Lukas

    Hi M.Albiero,

    Unfortunately currently at this point it's not possible to have a single API call to list all the subfolders recursively.

    Thanks,
    Erwin Lukas

    0
  • Danish

    how can i get the whole folder of the images from the cloudinary. Because if i make to request multiple time  to get the image that wont be a good practice.

    0
  • Wissam Khalili

    Hi Danish,

    You could use the following feature client side asset list to get a JSON list containing the image metadata list.

    To use this option, you will need to add a common tag to the images you need.

    For loading a large number of assets at once for use in your application, we recommend making an API call from your server-side code periodically and caching/storing the result on your side - for this example, the equivalent API method would be the get_resources method of the Admin API, which can return up to 500 results in each call (make sure to add max_results=500), and supports pagination to allow you to request more than 500 results by making multiple calls: https://cloudinary.com/documentation/admin_api#get_resources

    You will need to add the parameter prefix to specify the folder name.

    For example, here is a GET request to get the first 500 images from the folder called "sample"

    https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<cloud_name>/resources/image/upload?prefix=sample&max_results=500

    If you have more than 500 images in this folder, in the response, you will get another filed at the end called next_cursor.

    You could do another API call with this parameter to get the next 500 and so on.

    https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<cloud_name>/resources/image/upload?prefix=sample&max_results=500&next_cursor=<NEXT_CURSOR>

    Thanks,

    Wissam

    0
  • calysto steelband

    I don't understand how to access the object returned by api->root_folders()

    It looks to have the info I want in a private property called "storage".  How do I get to it?

    0
  • Stephen Doyle

    Hi,
    You should be able to access the folders in the "folders" property of the results that are returned by that call, e.g, using the V2 branch of our PHP SDK:

    $result = (new AdminApi())->rootFolders();
    print_r($result["folders"]);

    Please let me know if that works for you or if you're seeing some error

    Regards,

    Stephen

    0

Please sign in to leave a comment.