Enrich Your Media with Metadata

Metadata provides a conventional way to classify or describe assets in your catalogue. SHIFT extracts file metadata when assets created. This type of metadata is usually EXIF or XMP. However, it's common for library managers to include other metadata information. For example, it's common to add 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. They key is the lookup name and the value is, well, 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 need to.

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 you want to add metadata to. 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 using metadata 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?