How to get a list of my images from the cloud interface with client-side JavaScript?

Using the cloud API, I can get a list of images using GETting the following URL:

https://API_KEY:API_SECRET@api.cloudinary.com/v1_1/CLOUD_NAME/resources/image/upload

However, using this from client-side JavaScript, you can open the key and secret key of my account.

It seems that getting a list of images should be possible without exposing the credentials of my account.

I looked at the Cloudaign AngularJS client , which has an example project that implements photo slideshows in an account. From what I can tell, this project uses the following line to get a list of photos in a cloud account.

var url = $.cloudinary.url('myphotoalbum', {format: 'json', type: 'list'});

But I cannot get this call to return anything.

JQuery cloud documentation does not describe the syntax $.cloudinary.url(); the only resource I found is on the CloudMan jQuery Github page , which says that

$.cloudinary.url(public_id, options) // Returns a cloudinary URL based on your on your configuration and the given options.

What is public_id? What is options?

+4
source share
2 answers

Viewing all your resources requires the use of a secure API. It really requires a use api_secretthat should not appear in your client code. However, CloudMan does support returning a list of all images / raw files sharing a specific tag. The answer is a JSON snippet that is automatically updated and cached for 1 hour on the CDN.

API cloudinary.url URL- . :

var url = $.cloudinary.url('myphotoalbum', {format: 'json', type: 'list'});

URL- CloudMan, - :

http://res.cloudinary.com/<your_cloud_name>/image/list/myphotoalbum.json

URL- JSON , myphotoalbum.

+4

Source: https://habr.com/ru/post/1546144/


All Articles