Adding metadata to assets

Once the metadata schema has been added to your account, the process for adding or updating asset metadata is as follows:

  • Supply a pipe ("|") delimited CSV file of metadata exported from your product inventory system. This would include the name of the asset together with values for each of the required fields.

  • Upload this file to the specified location.

  • A script is run automatically to parse the metadata file, create the metadata, assign it to each asset and publish the updated asset.

On this page we'll explain each part of this process in more detail.

You can also add metadata to an asset manually using Content Hub. See Adding metadata using Content Hub.

Metadata file structure

Your technical consultant will specify the location to which you should upload the metadata file. The script to parse this file and create the metadata will run automatically every hour. You might also choose to upload the file to a location within your FTP server. The script will check for a file in the specified location, so the location should not change once it's specified.

The folder structure will be agreed with your technical consultant, but it will generally be something like.

Metadata

  toprocess

    metadata1.csv

    The metadata file that you upload

  processed

    metadata1-{timestamp}.csv

    Created by the script and containing the metadata successfully added

  invalid
    invalid-{timestamp}.csv

    Contains a file generated by the script that specifies any metadata that failed the script's validation. See below for more details.

Format of the metadata file

The metadata file contains the name of the asset, together with the values for each of the metadata fields. There are some important rules to note:

  • Each field is delimited with the pipe symbol "|"

  • All fields must be contained within "" quotes. Even number fields will be treated as strings within the CSV file

  • All fields must be supplied. Empty string fields are represented by empty quotes ""

Example

In the example introduced on the Defining your metadata schema page, there are three fields: original_price,sale_price and color. Here's an example of a metadata CSV file that adds metadata to assets using this schema. The file will contain the name of each asset, together with values for each of the fields:

"3256543_short_black_dress"|"29.99"|"19.99"|"black"|"3256548_signature_summer_dress"|"29.99"|"19.99"|"green"|
"3256548_winter_coat"|"99.99"|""|"white"|"3256555_fashion_mirror"|"49.99"|"39.99"|""Deleting metadata

To delete metadata from an asset, include "Delete" in the metadata file, followed by the name of the asset:

"Delete"|"3256543_short_black_dress"

The metadata CSV file is limited to 10000 lines. If you wish to add or update metadata for more than 10000 assets, then you would need to break this up in to multiple import jobs.

Processing the metadata file

When the metadata file is processed, the script will validate each of the field values you supply. Values that would fail the validation include field length, an unrecognised date format and letters in a numeric field, for example. The details of the assets to which metadata has not been added or updated will be written to a file contained in the "invalid" folder shown in the folder structure above.

Whenever metadata is added to an asset or updated, the asset must be re-published. This ensures that the latest version of the asset, including the metadata, is published to the Content Delivery Network (CDN) and available to your users. Newly created metadata will be available immediately. If you are updating an asset's metadata, then the older version of the asset may be cached in the CDN and not served to your users for up to 24 hours (depending on your "Time to Live" (TTL) settings). Similarly if you delete metadata from an asset, this change may not be available immediately.

Adding metadata using Content Hub

In most cases metadata will be added to an asset using an automated script. However, sometimes you may wish to add the metadata manually using Content Hub.

Open Content Hub and select the asset to which you wish to add the metadata. Right click the asset to display the settings menu and select the "Metadata" item.

Metadata can be viewed from the asset's menu
Metadata can be viewed from the asset's menu

The metadata pane is opened to the right of the asset. On the left hand side of this pane you'll see a list of the metadata sets that can be used with this asset. In this case we want to add metadata using "Tutorial Schema" so we click the name of the metadata set to select it.

Viewing the tutorial schema metadata
Viewing the tutorial schema metadata

Tutorial Schema defines three fields: color, original price and sale price. Add values for each of these fields (or leave them empty as required).

Fields in the tutorial schema
Fields in the tutorial schema

Entering metadata

The value entered in each field will be validated and saved when you click away from each field. No message will be displayed if a value is not valid- if you enter letters in a numeric field, for example, so you should check the values where the metadata pane is redrawn.

Once you have entered values for the Tutorial Schema shown above, refresh the pane by clicking on another metadata set (such as Image or EXIF) and then back to Tutorial Schema.

Some string fields, such as "color" defined in the Tutorial Schema, are facetable. This means that is easy to search and filter on this value from a limited number of options entered by the user. The values entered in this field are case sensitive, so if you entered "black" for the hat image above and then entered "Black" for the color for another asset, then two separate facets would be created. We recommend picking a consistent naming scheme for your fields to avoid this problem.

results matching ""

    No results matching ""