Importing placeholders, items, and files into Cantemo Portal

Often times you will want to use third party tools to create files and related items in Portal rather than uploading, importing from storage, or using an auto-import folder.

Here is the process I took which worked in registering both a new element available in a storage as well as adding different shapes to it. Hopefully it helps and is easy to replicate. I did it all with curl, but using anything else that can post should work fine.

First, we create a placeholder. I DIDN’T apply a settings profile to the placeholder, which means that it takes on the properties of the user that is authed in the API:

curl --data "<MetadataDocument xmlns=\"http://xml.vidispine.com/schema/vidispine\"><timespan end=\"+INF\" start=\"-INF\"><field><name>title</name><value>A Movie</value></field></timespan></MetadataDocument>" -H "Content-type: application/xml" -u admin:admin "http://cantemo:8080/API/import/placeholder?container=1&settings=VX-1"

This gives me back the id of my new placeholder (assuming it all worked)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ItemDocument id="VX-442" xmlns="http://xml.vidispine.com/schema/vidispine"/>

Next, I figured out what the VS ID of the master file was. In this case, I have two files, Amovie.mov and Amovie_lowres.mp4.

curl -H "Content-type: application/xml" -u admin:admin "http://cantemo:8080/API/storage/VX-4/file/byURI;path=Amovie.mov"

This returns the following XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><FileDocument xmlns="http://xml.vidispine.com/schema/vidispine">
	<id>VX-1542</id>
	<path>Amovie.mov</path>
	<uri>file:///media/flowrage/Space/Cantemo/Ingest/Amovie.mov</uri>
	<state>OPEN</state>
	<size>151672745</size>
	<timestamp>2014-12-17T16:39:26.708-05:00</timestamp>
	<refreshFlag>1</refreshFlag>
	<storage>VX-4</storage>
	<metadata>
	<field>
	<key>atime</key>
	<value>1418852349000</value>
	</field>
	<field>
	<key>created</key>
	<value>1416580881000</value>
	</field>
	<field>
	<key>mtime</key>
	<value>1416580881000</value>
	</field>
	</metadata>
</FileDocument>

From this, I now know my file has an ID of VX-1542. I can now register it to my placeholder (VX-442). I’ve made an ingest profile called “API” for this case that does NOT have any automatic shapes created.

curl --data "" -H "Content-type: application/xml" -u admin:admin "http://cantemo:8080/API/import/placeholder/VX-442/container?jobmetadata=portal_groups:StringArray%3dAPI&fileId=VX-1542"

On success I get back the job ID

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JobDocument xmlns="http://xml.vidispine.com/schema/vidispine">
	<jobId>VX-829</jobId>
	<user>admin</user>
	<started>2014-12-17T21:52:21.187Z</started>
	<status>READY</status><type>PLACEHOLDER_IMPORT</type>
	<priority>MEDIUM</priority>
</JobDocument>

Now I can register my lowres shape as well. Note that you have to have a shape name in Portal to register too, so you can’t just make up a shape name here. You can make a transcode profile that is “dummy” since you’ll never actually use it to transcode if you like. Repeat the first step to get my ID:

curl -H "Content-type: application/xml" -u admin:admin "http://cantemo:8080/API/storage/VX-4/file/byURI;path=Amovie_lowres.mp4"

Which returns:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FileDocument xmlns="http://xml.vidispine.com/schema/vidispine">
	<id>VX-1543</id>
	<path>Amovie_lowres.mp4</path>
	<uri>file:///media/flowrage/Space/Cantemo/Ingest/Amovie_lowres.mp4</uri><state>CLOSED</state>
	<size>11000050</size>
	<hash>7ec6c34713c630264946a6199726fd01407ab7af</hash>
	<timestamp>2014-12-17T16:45:28.266-05:00</timestamp>
	<refreshFlag>1</refreshFlag>
	<storage>VX-4</storage><metadata>
	<field>
	<key>atime</key>
	<value>1418852678000</value>
	</field>
	<field>
	<key>created</key>
	<value>1418852360000</value>
	</field>
	<field>
	<key>mtime</key>
	<value>1418852360000</value>
	</field>
	</metadata>
</FileDocument>

So now I have my lowres ID, I can register it:

curl --data "" -H "Content-type: application/xml" -u admin:admin "http://cantemo:8080/API/item/VX-442/shape?tag=lowres&fileId=VX-1543"

Which gives me the job doc again:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JobDocument xmlns="http://xml.vidispine.com/schema/vidispine">
	<jobId>VX-832</jobId>
	<user>admin</user>
	<started>2014-12-17T22:00:22.491Z</started>
	<status>READY</status>
	<type>SHAPE_IMPORT</type>
	<priority>MEDIUM</priority>
</JobDocument>

Last but not least, we trigger thumbnail creation

curl --data "" -H "Content-type: application/xml" -u admin:admin "http://cantemo:8080/API/item/VX-442/thumbnail/?createThumbnails=true&createPoster"

This dumps out my final job ID:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JobDocument xmlns="http://xml.vidispine.com/schema/vidispine">
	<jobId>VX-834</jobId>
	<user>admin</user>
	<started>2014-12-17T22:01:56.768Z</started>
	<status>READY</status>
	<type>THUMBNAIL</type>
	<priority>MEDIUM</priority>
</JobDocument>

Now I can hop to my Portal and make sure it all looks good in reality.