Deleting a Media Object

You may need to delete a media object to save space. In order to do this programmatically you will need to know the object id. When we showed you how to create a media object the object id was returned.

When you delete a media object, it is simply marked for deletion during the API call. It may take a few minutes to actually delete it.

Take a look at the following example to delete a media object.

PHP SDK

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

//define the object id
$id = 1543623;

//Include the MediaServ SDK and invoke the delete() function
include_once "path/to/mediaserv.php";
$mediaserv = new mediaserv($key, $secret);
$mediaserv->deleteFile($id);

CURL

copy
curl -X POST 
-d 'key=--API KEY HERE--
&secret=--API SECRET HERE--
&id=1543623' 
'http://api.mediaserv.x25.co/media/delete_object'