Cloudinary allows you to list all of your existing folders and subfolders via the Admin-API.
For example, for listing all root folders, send an HTTP GET request to the following URL:
Or, listing all folders within a subfolder:
Note that requests must first be signed with your credentials, as described in our Admin-API documentation.
Our client libraries provide helper methods to simplify the request, e.g. (PHP):
$api = new \Cloudinary\Api();
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
A dialog pops up "Authentication Required" / User Name: / Password: / OK
Clear the dialog and JSON return says:
What am I missing?
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.
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.
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.
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?
Unfortunately currently at this point it's not possible to have a single API call to list all the subfolders recursively.
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.
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"
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.
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?
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:
Please let me know if that works for you or if you're seeing some error
Please sign in to leave a comment.