HTTP request to attach uploadToken to mediaEntry

I am trying to integrate Kaltura with a media asset management platform that has the ability to post HTTP requests. The goal is to push content from this MAM directly to Kaltura through the API. Since the platform has its own workflow scripting language that allows me to send HTTP requests, the goal is to use the platform to do the requests needed to push content to Kaltura, rather than write an application in a language such as java, php, python, etc. Using a combination of basic HTTP requests in the MAM platform and curl commands, I am able to successfully create a session, create a media entry, create an upload token, and upload a file using that token. I can see the media entry in the KMC Content tab. However I’m not having any luck attaching the uploaded file to the media entry, so the entry shows no video. I can do this just fine in the TestMe console, but the console only shows me code samples in programming language formats rather than showing me the actual HTTP request that was made to Kaltura, so I don’t know what the request should be or what I’m doing wrong. Basically I need to know how I can do this in curl. Please note: using the provided Kaltura client libraries is not an option here… please don’t make suggestions that would require using the libraries and writing code in a programming language as I would like to keep the workflow native to the MAM platform. Here’s what my request looks like:

POST "${ks}&service=media&action=addContent&entryId=${entryId}&KalturaUploadedFileTokenResource:token=${tokenId}&format=1"

I am not getting any errors in the response. The media entry I created is there in the KMC Content area, When I upload the file with the token, I get a response that shows me the file size and statistics so it looks like the file was uploaded… I just can’t get it to attach to the media entry. Can someone show me what an actual HTTP request would look like to attach an uploadTokenResource to a mediaEntry? Thanks!!


How did you generate the token?
Basically, the requests you should make are:

uploadToken->add() returns an object which includes an id, that id is then passed on to the upload call, along with the file
then addFromUploadedFile() should get the entry, token and upload type.

This translates to something like:

# curl "-dclientTag=kalcli%3A15-08-12&uploadToken%3AobjectType=KalturaUploadToken&uploadToken%3AfileName=%2Ftmp%2Ffile&ks" ""
# curl "-dclientTag=kalcli%3A15-08-12&fileData=@somefile&uploadTokenId=&ks=" ""
# curl "-dclientTag=kalcli%3A15-08-12&uploadTokenId=&ks=&entry%3AobjectType=KalturaBaseEntry" ""

I would suggest you use the Kaltura CLI client libs to experiment. It is very easy because it also gives you a nice and easy tab completion when working from the shell and you can then use the -c flag to generate curl commands out of it, for instance:

# kalcli -x -c baseentry addFromUploadedFile uploadTokenId=$TOKEN  ks=`genks -b 102` entry:objectType=KalturaBaseEntry

will output:

curl "-dclientTag=kalcli%3A15-08-12&uploadTokenId=&ks=&entry%3AobjectType=KalturaBaseEntry" ""

You can download it from
Also see README here:

Which contains examples including one for Uploading files.

You have been INCREDIBLY helpful, this is exactly what I needed. Thank you for taking the time to make a meaningful response, I now have video successfully pushing to Kaltura from the media asset management system.

Glad to hear && happy to assist.