Schedule objects for deletion

To discover whether your Object Storage system supports this feature, see the section called “Discoverability”. Alternatively, check with your service provider.

Scheduling an object for deletion is helpful for objects that you do not want to permanently store, such as log files, recurring full backups of a dataset, or documents or images that become outdated at a specified future time.

To schedule an object for deletion, include one of these headers with the PUT or POST request on the object:

  • X-Delete-After

    An integer value. Specifies the number of seconds in the future when you want to delete the object.

    This header is converted to an X-Delete-At header that is set to the sum of the X-Delete-After value plus the current time, in seconds.

  • X-Delete-At

    A UNIX Epoch timestamp, in integer form. For example, 1348691905 represents Wed, 26 Sep 2012 20:38:25 GMT. Specifies the time when you want the object to expire, not be served, and be deleted completely from the object store.

Use the POST method to assign expiration headers to existing objects that you want expire.

 Delete object at specified time request: HTTP

In the example, the X-Delete-At header is assigned a UNIX Epoch timestamp in integer form for Mon, 11 Jun 2012 15:38:25 GMT. Use http://www.epochconverter.com/ for example timestamps and a batch converter.

# curl -i $publicURL/marktwain/goodbye -X PUT -H "X-Auth-Token: $token" -H "X-Delete-At: 1390581073" -H "Content-Length: 14" -H "Content-Type: application/octet-stream"

 Delete object after specified interval request: HTTP

This example sets the X-Delete-After header to a value in seconds that is equivalent to 10 days. After this time, the object expires.

PUT /<api version>/<account>/<container>/<object> HTTP/1.1
Host: storage.clouddrive.com
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb
Content-Type: image/jpeg
X-Delete-After: 864000
Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...