iconik-io

Metadata based CSV reader/writer CLI tool.

Introduction

This tool allows you to:

  • Input a given CSV into the metadata fields of a given asset in iconik.
  • Output the metadata fields of a given asset in iconik to a CSV.

Installation

Homebrew
Chocolatey
Linux
# add the tap to Homebrew
brew tap base-media-cloud/tap
brew install iconik-io

Usage

There are two modes of use for this command-line tool: input, and output.

Input Mode

Input mode takes a pre-populated CSV file conforming to the respective schema constraints and writes the contained metadata field values contained therein to the corresponding Metadata View for each Asset in iconik based on the supplied Collection ID.

Example

$ bmc-iconik-io -input input.csv -app-id <AppID> \
-auth-token <AuthToken> -collection-id <CollectionID> -iconik-url \
<IconikURL> -metadata-view-id <ViewID>

Schema

  • First row MUST be a header row.
  • R1C1 MUST be id.
  • R1C2 MUST be original_name.
  • R1C3 MUST be size.
  • R1C4 MUST be title.
  • R1C5 -> R1Cn are the name attributes of the metadata fields in the view you want to manipulate.
  • First column MUST always be the UUID of the asset.
  • Second column MUST always be the original filename of the asset.
  • Third column can include the filesize of the asset (in bytes), but if not including filesize MUST be left blank.
  • Fourth column MUST always be the title of the asset.
  • Columns 5->n are the values of the metadata fields in R1.
  • If a field can have multiple values (e.g., Tags), they must be comma separated in the appropriate cell.
  • If a field is boolean, it must be either true or false.

Example

Table 1 – CSV Example
idoriginal_namesizetitlefield1_namefield2_namebool_field_name
UUIDfilename1.mp4176985My asset titleField 1 ValueField 2 Value1, Field 2 Value2true
UUIDfilename2.mp4176985Another asset titleField 1 ValueField 2 Value1, Field 2 Value2false

The command line arguments required by input mode are listed in Table 2 – Input command-line arguments.

Table 2 – Input command-line arguments
FlagRequiredDescription
-input <FILE_PATH>no, provided output is used insteadPath to properly formatted CSV file
iconik-url <URL>noiconik URL (default "https://app.iconik.io")
-metadata-view-id <UUID>YESUUID of metadata view containing fields you want to update
-collection-id <UUID>YESUUID of collection containing assets you want to update
app-id <UUID>YESApp ID (provided by iconik)
auth-token <JWT>YESAuth token (provided by iconik)

Output Mode

Output mode creates a CSV file conforming to the respective schema constraints, and which contains the metadata field values of the corresponding Metadata View for each Asset in iconik which resides in the provided collection.

Example

$ bmc-iconik-io -output ~/Desktop -app-id <AppID> \
-auth-token <AuthToken> -collection-id <CollectionID> -iconik-url \
<IconikURL> -metadata-view-id <ViewID>

The command line arguments required by output mode are listed in Table 3 – Output command-line arguments.

Table 3 – Output command-line arguments
FlagRequiredDescription
-output <DIR_PATH>no, provided input is used insteadPath to directory where you want to save your CSV
iconik-url <URL>noiconik URL (default "https://app.iconik.io")
-metadata-view-id <UUID>YESUUID of metadata view containing fields you want to include in CSV
-collection-id <UUID>YESUUID of collection containing assets you want to include in CSV
app-id <UUID>YESApp ID (provided by iconik)
auth-token <JWT>YESAuth token (provided by iconik)

Command Reference

Name

bmc-iconik-io #iconik metadata CSV reader/writer

Synopsis

bmc-iconik-io [-h][-version]

bmc-iconik-io [-output <csv-filename>][-app-id <AppID>][-auth-token <AuthToken>][-collection-id <CollectionID>][-iconik-url <IconikURL>][-metadata-view-id <ViewID>]

Options
-output #toggles the tool to output mode ready to write a CSV file based on the supplied flag values.
-input #toggles the tool to input mode ready to read a CSV file based on the supplied flag values.
-iconik-url #expects a target URL for the iconik instance conforming the https URL schema. Default is https://app.iconik.io.
-app-id #the application key id corresponding to the JWT bearer Token generated in the iconik UI.
-auth-token #the JWT bearer Token generated in the iconik UI.
-collection-id #the ID of the collection in iconik where the assets reside.
-metadata-view-id #the ID of the Metadata View of interest.
Notes
  • If neither input or output mode is selected, the tool will display the version, and then exit.
  • The size value is returned in Bytes.