{"id":162,"date":"2016-04-29T09:35:27","date_gmt":"2016-04-29T13:35:27","guid":{"rendered":"http:\/\/provideotech.org\/?p=162"},"modified":"2016-08-18T14:40:12","modified_gmt":"2016-08-18T18:40:12","slug":"importing-placeholders-items-and-files-into-cantemo-portal","status":"publish","type":"post","link":"https:\/\/provideotech.org\/?p=162","title":{"rendered":"Importing placeholders, items, and files into Cantemo Portal"},"content":{"rendered":"<p>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.<\/p>\n<p>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.<\/p>\n<p><!--more--><\/p>\n<p>First, we create a placeholder. I DIDN&#8217;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:<\/p>\n<pre lang=\"bash\">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\" \r\n<\/pre>\n<p>This gives me back the id of my new placeholder (assuming it all worked)<\/p>\n<pre lang=\"xml\"><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<ItemDocument id=\"VX-442\" xmlns=\"http:\/\/xml.vidispine.com\/schema\/vidispine\"\/>\r\n<\/pre>\n<p>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.<\/p>\n<pre lang=\"bash\">curl -H \"Content-type: application\/xml\" -u admin:admin \"http:\/\/cantemo:8080\/API\/storage\/VX-4\/file\/byURI;path=Amovie.mov\"<\/pre>\n<p>This returns the following XML:<\/p>\n<pre lang=\"xml\"><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><FileDocument xmlns=\"http:\/\/xml.vidispine.com\/schema\/vidispine\">\r\n\t<id>VX-1542<\/id>\r\n\t<path>Amovie.mov<\/path>\r\n\t<uri>file:\/\/\/media\/flowrage\/Space\/Cantemo\/Ingest\/Amovie.mov<\/uri>\r\n\t<state>OPEN<\/state>\r\n\t<size>151672745<\/size>\r\n\t<timestamp>2014-12-17T16:39:26.708-05:00<\/timestamp>\r\n\t<refreshFlag>1<\/refreshFlag>\r\n\t<storage>VX-4<\/storage>\r\n\t<metadata>\r\n\t<field>\r\n\t<key>atime<\/key>\r\n\t<value>1418852349000<\/value>\r\n\t<\/field>\r\n\t<field>\r\n\t<key>created<\/key>\r\n\t<value>1416580881000<\/value>\r\n\t<\/field>\r\n\t<field>\r\n\t<key>mtime<\/key>\r\n\t<value>1416580881000<\/value>\r\n\t<\/field>\r\n\t<\/metadata>\r\n<\/FileDocument>\r\n<\/pre>\n<p>From this, I now know my file has an ID of VX-1542. I can now register it to my placeholder (VX-442). I&#8217;ve made an ingest profile called &#8220;API&#8221; for this case that does NOT have any automatic shapes created.<\/p>\n<pre lang=\"bash\">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\" \r\n<\/pre>\n<p>On success I get back the job ID<\/p>\n<pre lang=\"xml\"><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<JobDocument xmlns=\"http:\/\/xml.vidispine.com\/schema\/vidispine\">\r\n\t<jobId>VX-829<\/jobId>\r\n\t<user>admin<\/user>\r\n\t<started>2014-12-17T21:52:21.187Z<\/started>\r\n\t<status>READY<\/status><type>PLACEHOLDER_IMPORT<\/type>\r\n\t<priority>MEDIUM<\/priority>\r\n<\/JobDocument>\r\n<\/pre>\n<p>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&#8217;t just make up a shape name here. You can make a transcode profile that is &#8220;dummy&#8221; since you&#8217;ll never actually use it to transcode if you like. Repeat the first step to get my ID:<\/p>\n<pre lang=\"bash\">curl -H \"Content-type: application\/xml\" -u admin:admin \"http:\/\/cantemo:8080\/API\/storage\/VX-4\/file\/byURI;path=Amovie_lowres.mp4\"<\/pre>\n<p>Which returns:<\/p>\n<pre lang=\"xml\"><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<FileDocument xmlns=\"http:\/\/xml.vidispine.com\/schema\/vidispine\">\r\n\t<id>VX-1543<\/id>\r\n\t<path>Amovie_lowres.mp4<\/path>\r\n\t<uri>file:\/\/\/media\/flowrage\/Space\/Cantemo\/Ingest\/Amovie_lowres.mp4<\/uri><state>CLOSED<\/state>\r\n\t<size>11000050<\/size>\r\n\t<hash>7ec6c34713c630264946a6199726fd01407ab7af<\/hash>\r\n\t<timestamp>2014-12-17T16:45:28.266-05:00<\/timestamp>\r\n\t<refreshFlag>1<\/refreshFlag>\r\n\t<storage>VX-4<\/storage><metadata>\r\n\t<field>\r\n\t<key>atime<\/key>\r\n\t<value>1418852678000<\/value>\r\n\t<\/field>\r\n\t<field>\r\n\t<key>created<\/key>\r\n\t<value>1418852360000<\/value>\r\n\t<\/field>\r\n\t<field>\r\n\t<key>mtime<\/key>\r\n\t<value>1418852360000<\/value>\r\n\t<\/field>\r\n\t<\/metadata>\r\n<\/FileDocument>\r\n<\/pre>\n<p>So now I have my lowres ID, I can register it:<\/p>\n<pre lang=\"bash\">curl --data \"\" -H \"Content-type: application\/xml\" -u admin:admin \"http:\/\/cantemo:8080\/API\/item\/VX-442\/shape?tag=lowres&fileId=VX-1543\" \r\n<\/pre>\n<p>Which gives me the job doc again:<\/p>\n<pre lang=\"xml\"><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<JobDocument xmlns=\"http:\/\/xml.vidispine.com\/schema\/vidispine\">\r\n\t<jobId>VX-832<\/jobId>\r\n\t<user>admin<\/user>\r\n\t<started>2014-12-17T22:00:22.491Z<\/started>\r\n\t<status>READY<\/status>\r\n\t<type>SHAPE_IMPORT<\/type>\r\n\t<priority>MEDIUM<\/priority>\r\n<\/JobDocument>\r\n<\/pre>\n<p>Last but not least, we trigger thumbnail creation<\/p>\n<pre lang=\"bash\">curl --data \"\" -H \"Content-type: application\/xml\" -u admin:admin \"http:\/\/cantemo:8080\/API\/item\/VX-442\/thumbnail\/?createThumbnails=true&createPoster\" \r\n<\/pre>\n<p>This dumps out my final job ID:<\/p>\n<pre lang=\"xml\"><?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<JobDocument xmlns=\"http:\/\/xml.vidispine.com\/schema\/vidispine\">\r\n\t<jobId>VX-834<\/jobId>\r\n\t<user>admin<\/user>\r\n\t<started>2014-12-17T22:01:56.768Z<\/started>\r\n\t<status>READY<\/status>\r\n\t<type>THUMBNAIL<\/type>\r\n\t<priority>MEDIUM<\/priority>\r\n<\/JobDocument>\r\n<\/pre>\n<p>Now I can hop to my Portal and make sure it all looks good in reality.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. &hellip; <a href=\"https:\/\/provideotech.org\/?p=162\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Importing placeholders, items, and files into Cantemo Portal&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[13],"tags":[],"class_list":["post-162","post","type-post","status-publish","format-standard","hentry","category-cantemo-portal"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bwLw-2C","_links":{"self":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=162"}],"version-history":[{"count":0,"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/162\/revisions"}],"wp:attachment":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}