Search API - include structured metadata in results?
I'm a newbie working on the free plan, and I was wondering if it is possible to return the structured or contextual metadata in the result of a search? I know I have to be tier 2 in order to access embedded data, and use that as part of the search criteria, but I'm less clear if this also applies to displaying data in the results or displaying structured or contextual metadata? This would allow me to build a JSON file with all the data I need for an image gallery for a website project, including caption and alt text.
any tips or suggestions would be greatly appreciated. thanks!
-
Hi John,
To include the contextual metadata in the search result, you can include with_field('context'). Then for structured metadata, you can include with_field('metadata'). Please let me know how it goes.
Regards,
Francis0 -
Thanks Francis,
when I run a command like this:
cld search "tags=dogs with_field('context')"
I get the exact same results as I do with this command:
cld search tags=dogs
For each matching asset, I'm hoping the results will include any values added here:
0 -
Hi John,
In using the CLI, you can use the option -f or --with_field. Here is the example command for your case:
cld search -f context "tags=dogs"
OR
cld search --with_field context "tags=dogs"
You can learn more about this in the documentation:
https://cloudinary.com/documentation/cloudinary_cli#searchPlease note that in your screenshot, the resource does not have the tag "dogs" so it won't be in the search result.
Hope this helps, please let me know if you have further questions
Regards,
Francis1 -
Thanks Francis - I was struggling a bit with the syntax, this should help :)
0 -
I can confirm that this worked exactly as I hoped. Thanks for your patience Francis.
0 -
You're welcome, John! Glad I could help :)
0
Post is closed for comments.
Comments
6 comments