Enrich Your Media with Metadata

Metadata provides a conventional way to classify or describe assets in your catalog. Shift extracts file metadata when assets are created. This type of metadata is usually EXIF or XMP. However, it's common for library managers to include other metadata information, such as location data, attribution, licensing details, and source-file storage path details.

Key / Value Pairs

In Shift, metadata is stored in a simple key and value pair. The key is the lookup name, and the value is the value. For example, a common key/value pair is "Director: Michael Chapel." In this case, "Director" is the key, and "Michael Chapel" is the value. You can add as many key/value pairs to you assets as you want.

Adding Metadata to an Asset

You can add one or more metadata key/value pairs to an asset at a given time. Be sure you know the ID of the asset to which you want to add metadata. Here's an example of adding metadata to an asset.

curl --request POST \
  --url https://api.shift.io/v3/assets/YOUR_ASSET_ID/metadata \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-key: YOUR_API_KEY' \
  --header 'x-secret: YOUR_API_SECRET'
  --data '[
  { "key":"Director","value":"Michael Chapel"},{"key":"Location","value" : "Fundy, NB"}]'

Searching for Assets Using Metadata

You can search for assets that have metadata by using the same APIs that are used in the Shift app.

Here's how we can execute the same search in the image above using the Shift API.

curl --request GET \
  --url https://api.shift.io/v3/assets?_page=1&_pageSize=25&_sortBy=dateCreated&_sort=desc&_includeAggregates=true&_query={"and":[{"and":[{"and":[{"metadata.key":{"ct":"director"}},{"metadata.value":{"ct":"michael chapel"}}]}]}]} \
  --header 'accept: application/json' \
  --header 'x-key: YOUR_API_KEY' \
  --header 'x-secret: YOUR_API_SECRET'

Did this page help you?