Skip to main content

Search API - SortBy metadata?



  • Official comment
    Akshay Joshi

    Hi Alan,

    Cloudinary structured metadata allows you to define typed fields for media assets, populate them with values programmatically or via the Media Library, and perform searches on them. You can also add validation rules, set default values, and define fields as mandatory.

    Click the link for the documentation of Metadata API.

    It's possible to search for resources based on either embedded metadata or structured metadata using Cloudinary's search APIThe search API uses query language to search resources and it is possible to build complex expressions to base the search on. 

    Searching using structured metadata requires using the `metadata` field in the search expression.

    You can see a full explanation and additional details on how to search using structured metadata in our documentation about search fields



  • Alan Lawrance

    The documentation is a bit vague on the definition for "field" used for the sort_by parameter. 

    So my specific question is can the "field" used by sort_by be the key of a contextual metadata key/value  pair.

    I've tried the following (where 'budget' is the key for contextual metadata):



    But both result in errors when passed into SortBy like:

    .SortBy("context:budget", "desc")

  • Alan Lawrance

    It has bee confirmed in a separate thread that sorting by metadata isn't possible at this time. Would love to see it in the future!

  • Jonathan Sexton

    Hi Alan!  I’m Jonathan, one of the Customer Success Managers here at Cloudinary.  We’re always happy to get feedback and suggestions from our users.  

    In fact, you can help shape the future direction of our roadmap by submitting your feature request here:

    On the bottom left page you’ll be able to click the + icon and submit a new idea.

    If you have any other questions we’re always happy to help!


Post is closed for comments.