UC Edit Item Metadata
Motivation
It is not uncommon that metadata related to an item is updated. This could be metadata defining the current status of the item within a workflow, time-coded subtitles being added or content descriptions just to mention some examples.
When doing updates to metadata in VidiCore the changes are stored in a change set. Looking at the item the current revision of the metadata is essentially the superset of all change sets.
Example
In order to have a metadata field for our item, we first have to create the field within the system.
PUT /metadata-field/event_type
<MetadataFieldDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<type>string-exact</type>
<stringRestriction>
<pattern>[a-z]+</pattern>
</stringRestriction>
</MetadataFieldDocument>
Where event_type
is the name of our metadata field which we define to be of the type string-exact
and with a restriction to the string value to only allow zero to indefinite numbers of the characters a to z.
Once we have the field we can update the field for our item by doing a PUT
request to the item
PUT /item/VX-1/metadata
<MetadataDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<timespan start="1200" end="1380">
<field>
<name>event_type</name>
<value>goal</value>
</field>
</timespan>
</MetadataDocument>
In this example we put the metadata within a timespan <timespan start="1200" end="1380">
with the value goal
.
We can verify this by doing a GET request to the item
GET /item/VX-1?content=metadata
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ItemDocument id="VX-1" xmlns="http://xml.vidispine.com/schema/vidispine">
<metadata>
<revision>VX-190,VX-189,VX-192,VX-191,VX-305</revision>
<timespan start="-INF" end="+INF">
<field uuid="2ca558ac-2b3d-495a-91e3-80047ba0753b" user="system" timestamp="2022-03-30T21:22:21.624+02:00" change="VX-189">
<name>created</name>
<value uuid="304f2a73-1875-478e-afe0-c8dc828547aa" user="system" timestamp="2022-03-30T21:22:21.624+02:00" change="VX-189">2022-03-30T19:22:21.458Z</value>
</field>
<field uuid="56d527f1-774e-4f78-87a9-9f61055988f0" user="system" timestamp="2022-03-30T21:22:21.624+02:00" change="VX-189">
<name>itemId</name>
<value uuid="951dbce6-84a1-471a-87ba-79298ad80b84" user="system" timestamp="2022-03-30T21:22:21.624+02:00" change="VX-189">VX-38</value>
</field>
<field uuid="0c014a82-d61c-41f9-adcf-0a5f2f0afae9" user="system" timestamp="2022-03-30T21:22:21.670+02:00" change="VX-190">
<name>shapeTag</name>
<value uuid="5c3e1a9b-a4a5-4c61-8a39-eab2b28aed58" user="system" timestamp="2022-03-30T21:22:21.670+02:00" change="VX-190">original</value>
</field>
<field uuid="fc9b8fcf-0dcd-4f6b-9098-d0703e166b8c" user="system" timestamp="2022-03-30T21:28:43.614+02:00" change="VX-191">
<name>originalFilename</name>
<value uuid="72cc6c81-e8e0-4361-bdb9-68e74d207a45" user="system" timestamp="2022-03-30T21:28:43.614+02:00" change="VX-191">testfil.mp4</value>
</field>
<field uuid="f196a97f-053e-4ff9-b070-18ca5d3ac1f9" user="system" timestamp="2022-03-30T21:28:43.614+02:00" change="VX-191">
<name>mediaType</name>
<value uuid="67441bc0-56b4-4b1c-bde1-56ec8a1d4fdd" user="system" timestamp="2022-03-30T21:28:43.614+02:00" change="VX-191">video</value>
</field>
<field uuid="09b9b4f2-756c-4975-96e3-bf950e675536" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>originalFormat</name>
<value uuid="90b225ad-0db8-4dc8-b659-42398f5f0992" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">mov,mp4,m4a,3gp,3g2,mj2</value>
</field>
<field uuid="bab76a96-f0e5-41e7-91ae-da2d5827fe30" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>originalVideoCodec</name>
<value uuid="2a4d47bc-ad8f-4e79-880a-a4975be1d730" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">h264</value>
</field>
<field uuid="2e1b1030-223c-44eb-b905-a038924aa61f" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>originalAudioCodec</name>
<value uuid="b7a6e2fb-0946-493f-8f13-aa32894b17c8" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">aac</value>
</field>
<field uuid="3e581bf5-f505-4e93-b10d-1cd3266c41fc" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>durationSeconds</name>
<value uuid="2249f911-629c-4106-a59c-a670bb8e2fe3" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">4646.016</value>
</field>
<field uuid="7ac1a9e3-dcb9-4a90-86eb-112f85333770" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>durationTimeCode</name>
<value uuid="3ffa6ff7-8746-4412-ab3f-0ce94e67b68a" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">4646016000@1000000</value>
</field>
<field uuid="2b14261e-af9c-4b53-b82d-2a36c1c8f1e9" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>originalWidth</name>
<value uuid="cc7c39fa-d12b-4738-936c-4d3d528870c6" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">1280</value>
</field>
<field uuid="04a0f871-71c6-43fd-af13-464d78c90586" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>originalHeight</name>
<value uuid="f258da9c-ee03-45be-93c9-2f0ecf7d545a" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">720</value>
</field>
<field uuid="ddcc8a9d-eb43-4c74-a701-82739a67f5c3" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>mimeType</name>
<value uuid="2c029788-c79f-4205-9897-09153ed188f7" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">video/mp4</value>
</field>
<field uuid="feb0c465-eac4-45b6-9df7-32e625ffa8f4" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">
<name>originalUri</name>
<value uuid="2eceb004-4f8b-4f0b-a99d-e2bc9ac508eb" user="system" timestamp="2022-03-30T21:28:43.713+02:00" change="VX-192">file:///storage/testfil.mp4</value>
</field>
<field>
<name>__user</name>
<value>admin</value>
</field>
<field>
<name>user</name>
<value>admin</value>
</field>
<field>
<name>__metadata_last_modified</name>
<value>2022-05-16T12:41:01.132+02:00</value>
</field>
<field>
<name>__placeholder_shape_size</name>
<value>0</value>
</field>
<field>
<name>__shape_size</name>
<value>1</value>
</field>
<field>
<name>__shape</name>
<value>VX-48</value>
</field>
<field>
<name>__version_count</name>
<value>1</value>
</field>
<field>
<name>__version</name>
<value>0</value>
</field>
<field>
<name>__shapetag_original_hash</name>
<value>ae3f0529a5dec2459fc5c690e8767d14caf49cc4</value>
</field>
<field>
<name>__shape_last_added</name>
<value>2022-03-30T19:22:21.642Z</value>
</field>
<field>
<name>__storage_original</name>
<value>VX-1</value>
</field>
<field>
<name>__storage_original_size</name>
<value>1</value>
</field>
<field>
<name>__storage_size</name>
<value>1</value>
</field>
<field>
<name>__storage</name>
<value>VX-1</value>
</field>
<field>
<name>__storagegroup_size</name>
<value>1</value>
</field>
<field>
<name>__storagegroup</name>
<value>test_group</value>
</field>
<field>
<name>__sequence_size</name>
<value>0</value>
</field>
<field>
<name>__collection_size</name>
<value>3</value>
</field>
<field>
<name>__collection</name>
<value>VX-23</value>
</field>
<field>
<name>__collection</name>
<value>VX-22</value>
</field>
<field>
<name>__collection</name>
<value>VX-21</value>
</field>
<field>
<name>__ancestor_collection_size</name>
<value>4</value>
</field>
<field>
<name>__ancestor_collection</name>
<value>VX-16</value>
</field>
<field>
<name>__ancestor_collection</name>
<value>VX-22</value>
</field>
<field>
<name>__ancestor_collection</name>
<value>VX-21</value>
</field>
<field>
<name>__ancestor_collection</name>
<value>VX-23</value>
</field>
</timespan>
<timespan start="1200" end="1380">
<field uuid="91f8a252-2e0d-44b8-a9ce-751dd3bc4602" user="admin" timestamp="2022-05-16T12:41:01.132+02:00" change="VX-305">
<name>event_type</name>
<value uuid="d553b414-e6d2-4dba-984d-690fc8686d58" user="admin" timestamp="2022-05-16T12:41:01.132+02:00" change="VX-305">goal</value>
</field>
</timespan>
</metadata>
</ItemDocument>
Resources
For more information on updating item metadata, please refer to the following section
https://apidoc.vidispine.com/latest/ref/metadata/metadata.html#manipulating-change-sets
How to
https://apidoc.vidispine.com/latest/item/metadata/metadata.html#item-metadata