How to search by metadata.usageterms
Hi,
We differentiate channel usage with Usage Terms, i.e. CRM for email marketing, etc.
Is there code like the following (using the Search API) to retrieve image data for our 'CRM' images?
result = cloudinary.Search().expression('resource_type:image AND metadata.usageterms=CRM').sort_by('public_id','desc').max_results('30').execute()
print(result)
Thanks!
-
Hi John,
A search expression of `resource_type:image AND metadata.usageterms=CRM` should return any images with a value of 'CRM' set for a structured metadata field with external_id of "usageterms" as you say.
If you're not getting the expected results, please check if the metadata field you're searching indeed has "usageterms" as the external_id - the external_id is an identifier for that field used in our APIs but this is not the same name shown in the Media Library for the field. Unless you chose the external_id value explicitly when creating the field, it's most likely a random series of characters.
You can find the external_id for your metadata fields by using the API ( https://cloudinary.com/documentation/metadata_api ) or by selecting the field in the 'Managed Structured Metadata" page of the account settings ( https://cloudinary.com/console/media_library/metadata_fields
If that doesn't explain it, may I please ask you to create a support ticket with your account details, and an example of an image you expect to be returned by that search but which isn't in the result set?
Regards,Stephen
0
Post is closed for comments.
Comments
1 comment