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 "title A Movie " -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)
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:
VX-1542
Amovie.mov
file:///media/flowrage/Space/Cantemo/Ingest/Amovie.mov
OPEN
151672745
2014-12-17T16:39:26.708-05:00
1
VX-4
atime
1418852349000
created
1416580881000
mtime
1416580881000
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
VX-829
admin
2014-12-17T21:52:21.187Z
READY PLACEHOLDER_IMPORT
MEDIUM
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:
VX-1543
Amovie_lowres.mp4
file:///media/flowrage/Space/Cantemo/Ingest/Amovie_lowres.mp4 CLOSED
11000050
7ec6c34713c630264946a6199726fd01407ab7af
2014-12-17T16:45:28.266-05:00
1
VX-4
atime
1418852678000
created
1418852360000
mtime
1418852360000
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:
VX-832
admin
2014-12-17T22:00:22.491Z
READY
SHAPE_IMPORT
MEDIUM
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:
VX-834
admin
2014-12-17T22:01:56.768Z
READY
THUMBNAIL
MEDIUM
Now I can hop to my Portal and make sure it all looks good in reality.