Further details about this method can be found in the Advanced URL Delivery Options documentation
Cloudinary supports listing resources from the client-side by their tags.
The response is a JSON
snippet containing all resources which correspond to the specified tag. When delivered, this JSON snippet cached for 1 minute on the CDN and is automatically updated if the images are updated.
An HTTP request to fetch a JSON list of images sharing a tag will look something like:
http://res.cloudinary.com/<your_cloud_name>/<resource_type>/list/<tag>.json
The URL can also be generated using our client-libraries, e.g. (jQuery):
$.cloudinary.url('logo', {format: 'json', type: 'list'})
This will create the following URL ('resource_type' defaults to 'image'):
http://res.cloudinary.com/demo/image/list/logo.json
Which when sent as an HTTP request, the following JSON
will be returned
{
"resources":[{"public_id":"..", ... }, ...],
"updated_at":"..."
}
Note, that if one or more of the relevant tagged resources are of type 'authenticated', the list URL should be signed. The signature can be added manually (by following the steps detailed here), or, when using our server-side libraries, by adding the 'sign_url' parameter set to 'true', e.g (Node.js):
cloudinary.url("logo.json", {type: "list", sign_url: true})
In addition, note, that by default, the Image list is restricted, so to enable it, open the Security Settings in your Cloudinary Console, and clear the Resource list item under Restricted image types.
For more information:
https://cloudinary.com/documentation/advanced_url_delivery_options#client_side_resources
Comments
14 comments
Was searching for this functionality. Thank you very much.
I am getting a CORS error when trying to fetch this URL from my angular application. How can i fix that issue?
Is it available for the Free Plan?
Suresh, please contact us via Support ticket so we can investigate further and find a solution to this failure.
http://support.cloudinary.com/hc/en-us/requests/new
Local, This feature is available to all of our users, regardless of the plan.
Thanks.
Whats the best way to blow out this cache. I would think you would invalidate it on a new upload.
It appears I have to make 3 api delete requests (image/video/raw) keeping originals to blow out the cached json files every time a new image is uploaded. Seems like a total pain.
Resources of type list are cached in the CDN for 1 minute and are removed with any change that can make the existing result no longer relevant.
If you encounter any different behavior you are welcome to open a support ticket and we'll be happy to look into it.
>UPDATE: This method was recently added to the documentation section.
Using this ^^ new approach, is there a way to not return deleted images?
The function worked a few times without any problems but now I keep getting xhr.js:178 GET http://res.cloudinary.com/flycrow/video/list/test.json 404 (Not Found)
The video is in my media library and has the correct tag. Does anyone know why I'm suddenly getting 404 errors most of the time?
In case anyone else comes up against this problem, I think it happened because I deleted the first video I uploaded which deleted the .json file. If I try with a different tag, it works.
Thanks for the update Darryll! If you still require our assistance, please feel free to open a ticket and we'll gladly help you solve the issue.
Followed directions exactly and doesn't appear to work. This works though:
Please contact us at support@cloudinary.com with your cloud name and we can investigate this issue and find solutions.
Please sign in to leave a comment.