Multiple API methods can be used to list the contents of a folder to provide a list of matching assets to populate your own database or perform administrative actions.
Admin API
You can use the Admin API to list all resources contained within a specific folder (including sub-folders).
Here's an example of how to accomplish this (in Node.js). Before running the code, inside the index.js
file, please add your cloud_name
, api_key
, and api_secret
associated with your account in the cloudinary.config
starting line 4 and the folder in line 12:
Search API
Alternatively, the Search API can be used to list all resources contained within a specific folder (including sub-folders).
Here's an example of how to accomplish this (in Node.js). Before running the code, inside the index.js
file, please add your cloud_name
, api_key
, and api_secret
associated with your account in the cloudinary.config
starting line 4 and the folder in line 11:
Frontend code
Because the Search API and Admin API methods are rate limited and require authentication, they are not suitable for calling directly from frontend code, or to retrieve a list of assets in "real time" to use in your frontend. In such cases, the best solution is likely to use the Admin or Search API to populate your own database of assets, and use that database when building the frontend URLs.
Another option which may be suitable if your frontend needs to retrieve the list of assets directly from Cloudinary is to add a common tag to assets that will be used together, and use a Client Side Asset List to fetch a list of assets matching that tag. This is the primary method used by Cloudinary's Product Gallery Widget to retrieve asset details, and typically the tag represents a product's SKU or other identifier.
Comments
32 comments
"Exporting such a list requires using the Admin-API. It's on our roadmap to add UI support for this task as well." <Post from 5 years ago>
Is there a reason that after 5 years a customer would still have to use cumbersome and time consuming coding and API calls just to get a list of file names in their repositories?! What if they don't have easy access to coding experts or resources? If this can be done through an API, why can't Clouldinary simply embed that API call (or calls) into a simple user interface function that then export to a .csv or .xls file?
Hi Jim,
In general our core service is optimized for bulk or automated operations that are often performed by developers of a website or application, and our Media Library UI is optimized for user-facing asset management workflows which typically operate on relatively small number of assets for each operation (indeed, usually individual assets).
Though the Media Library UI doesn't support exporting a list of your account's assets, we expect that this may be added in the future but as you've said, this hasn't yet been prioritized over other features, so there's no ETA we can provide.
In the meantime, if you don't have the resources available to use the API directly, we recommend that you use our CLI tool on your computer to create a list using our search API and saving the results in CSV format - (see the 'search' option, with the "--csv" parameter): https://cloudinary.com/documentation/cloudinary_cli
Regards,
Stephen
Please sign in to leave a comment.