Creating a Media Object

A Media Object can be a video, photo, PDF, or any other type of file. When creating a media object you must provide 3 parameters: The media url, the downloaded call back, and the process callback.

The media url is quite simple. You don't actually upload the media file to the API. Instead, our server will download it from your server. During this process MediaServ figures out the file format, and proceeds with the next actions to process and store the file.

The downloaded callback parameter tells MediaServ how to communicate to your server that the file has successfully been downloaded to our servers and it's safe to delete.

The process callback is a way for MediaServ to notify your application that the processing and storage of your file has been complete. It can take a few minutes before this is triggered. This depends on how big the file is, whether it's a photo or video, and what quality the original file is.

Check out this example:

PHP SDK

copy
//Define the API Key and Secret
$key = "--- API Key Here ---";
$secret = "--- Secret Key Here ---";

//define the media URL and callback URL's
$mediaURL = "http://example.com/video.mp4";
$downloadCb = "http://example.com/downloadCb.php?id=my_id";
$processCb = "http://example.com/successCb.php?id=my_id";

//Include the MediaServ SDK and invoke the create function
include_once "path/to/mediaserv.php";
$mediaserv = new mediaserv($key, $secret);
$info = $mediaserv
	->addFile($mediaURL, $downloadCb, $processCb);
var_dump($info);

CURL

copy
curl -X POST 
-d 'key=--API KEY HERE--
&secret=--API SECRET HERE--
&url=http://example.com/path/to/media.mp4
&download_callback=http://example.com/downloadCb?id=your_id
&process_callback=http://example.com/processCb?id=your_id' 
'http://api.mediaserv.x25.co/media/create_object'