Admin API get metadata of images for a particular folder

smiffy_chris
smiffy_chris Member Posts: 6
edited August 21 in Developer APIs

Hi,

New to Cloudariny and I have a GET request that retrieves images in a folder. I'm not able to get my image meta data with this request. I try with context set to true to retrieve meta data but that is not working.

Any help would be appreciated!

Tagged:

Best Answer

Answers

  • SreeCloudinary
    SreeCloudinary Member, Cloudinary Staff Posts: 44

    Hi @smiffy_chris ,

    Thanks for contacting Cloudinary.

    There are different Tiers in Cloudinary and the with_field metadata only works for Tier 2 and Above.

    Please find the Tier ifnormation we have:

    https://cloudinary.com/documentation/search_method#tiers

    The reference of Tier-2 in Search Expression can be found at:

    https://cloudinary.com/documentation/admin_api#search_for_resources_optional_parameters

    I hope this helps. Please let me know if you have any further questions.

    Thanks,
    Sree

  • smiffy_chris
    smiffy_chris Member Posts: 6
    edited August 20

    So the GET all assets can bring back meta data for images but to get assets within a folder does not bring back meta data? Strange.

    How can I get tier 2 access? I'm a small business and would like to pay as I go.

    Or is there another way to use the tier 1 api? Should I use tags instead?

  • Tom
    Tom Member, Cloudinary Staff Posts: 108

    Hi @smiffy_chris ,

    Thanks for replying.

    Could you please clarify what you mean by image data? Are you referring to embedded image metadata or data such as context, tags and structured metadata which can be set on individual assets on Cloudinary?

    If the latter then, using Get resources by asset folder should work by passing metadata, context and tags parameter as true.

    To view the embedded metadata of an asset, you need to use Get details of a single resource by public ID or Get details of a single resource by asset ID and pass media_metadata as true.

    You should not need tier 2 access currently as this mainly applies when using Search API on image analysis and embedded metadata fields.

    Please let me know if you have any other questions or queries.

    Kind Regards,

    Thomas

  • smiffy_chris
    smiffy_chris Member Posts: 6

    I'm trying with another route to pull images with a tag and include the metadata with those images. My route pulls the images but I don't see any metadata. Here is my code… my API url is cut off so here are the two URLs:

       const apiUrl = cursor            

    ? `https://api.cloudinary.com/v1_1/${cloudName}/resources/search?max_results=${max_results}&expression=tags=${tag_name}&next_cursor=${cursor}&context=true`            :

    `https://api.cloudinary.com/v1_1/${cloudName}/resources/search?max_results=${max_results}&expression=tags=${tag_name}&context=true`;

  • smiffy_chris
    smiffy_chris Member Posts: 6

    With my route to pull images with a given tag, I'm not returning any metadata.. Is there a better way to be pulling this so I can include metadata?

    My apiURL got cut off in the code so here are the full links

       const apiUrl = cursor             ? `https://api.cloudinary.com/v1_1/${cloudName}/resources/search?max_results=${max_results}&expression=tags=${tag_name}&next_cursor=${cursor}&context=true`            : `https://api.cloudinary.com/v1_1/${cloudName}/resources/search?max_results=${max_results}&expression=tags=${tag_name}&context=true`;

  • Tom
    Tom Member, Cloudinary Staff Posts: 108

    Hi @smiffy_chris ,

    Thanks for replying.

    It looks like you are now using Search API so to get the metadata you need to pass the with_field parameter with the metadata value.

    You can also look at our Postman collections to find the proper syntax of these API calls, see https://cloudinary.com/documentation/using_cloudinary_postman_collections .

    Please let me know if you have any other questions or queries.

    Kind Regards,

    Thomas