Searching by Metadata

Many Shift users enrich their media with metadata. You can use this metadata to quickly find the files you need.

Searching for a specific key and value

The most common use case is to search for files that contain a specific metadata key and value. For example, let's find any files with a location of "Catalina."

curl --request GET \
  --url https://api.shift.io/v3/assets?_query={"and": [{"metadata.key": {"eq": "location"}}, {"metadata.value": {"eq": "Catalina"}}]} \
  --header 'accept: application/json' \
  --header 'x-key: YOUR_API_KEY' \
  --header 'x-secret: YOUR_API_SECRET'

Searching for a combination of metadata

In some cases, you need to search for assets with a combination of metadata key values because one pair is not sufficient. Let's find all files with a location of Catalina that were also directed by "Michael Chapel."

curl --request GET \
  --url https://api.shift.io/v3/assets?_query={"and": [{"and": [{"metadata.key": {"eq": "location"}}, {"metadata.value": {"eq": "Catalina"}}]}, {"and": [{"metadata.key": {"eq": "director"}}, {"metadata.value": {"eq": "Michael Chapel"}}]}]} \
  --header 'accept: application/json' \
  --header 'x-key: YOUR_API_KEY' \
  --header 'x-secret: YOUR_API_SECRET'

This query is a bit larger. You can view it pretty-printed here:

{
    "and": [{
        "and": [{
            "metadata.key": {
                "eq": "location"
            }
        }, {
            "metadata.value": {
                "eq": "Catalina"
            }
        }]
    }, {
        "and": [{
            "metadata.key": {
                "eq": "director"
            }
        }, {
            "metadata.value": {
                "eq": "Michael Chapel"
            }
        }]
    }]
}

Did this page help you?