How to retrieve metadata using @cloudinary/url-gen

Comments

3 comments

  • Avatar
    Loic Verger Del Bove

    Hi Yuriy,

    The project is associated with frontend SDKs so you won't be able to do Admin API requests. However, an alternative you can use is by using the client-side assets list.

    This requires tagging your assets but you could use it to get back those metadata without a backend.

    Hope that helps.

    Best,

    Loic

    0
    Comment actions Permalink
  • Avatar
    Yuriy Boev

    Thank you, Loic! This sounds a bit complex for something that I thought should be coming out of the box. Perhaps a separation could be added for custom metadata fields and standard alt/title fields and make them available through the API?

    Have a great day,
    Yuriy

    0
    Comment actions Permalink
  • Avatar
    Raz Ziv

    Hey Yuriy,

    The reason you can't perform admin API actions from the client-side is because of security mesaures.
    The admin API is intended for administrative actions including destructive operations, retrieving internal information about your assets and ones that can modify many different aspects of your account. As such, such requests require authentication credentials to be passed within the request. When making client-side requests, this information is of course publicly exposed to the client visiting your website/application. Therefore, using these methods via the client would be a major security breach.

    With that being said, as Loic mentioned, we introduced other approaches for retrieving some limited information, using a less-intrusive method, which can only return details of assets you meant to be returned by tagging them with specific tags. It might be a bit time-consuming to retrospectively tag existing assets on your cloud using the Explicit API method or the UI, but with regard to new assets uploads, you can just make sure that you change your upload calls to include the relevant tags in the requests' parameters.

    I'm afraid that currently, all information retrieval API methods are part of the Admin/Search APIs which require the above-mentioned authentication which is not client-side suitable. The only feasible approach at the moment would be using the list API. You can open a direct support ticket with us if you need our assistance with writing the script that will tag all existing images based on some pre-defined criteria.

    Best,
    Raz

    0
    Comment actions Permalink

Please sign in to leave a comment.