Deleting Containers

All objects within a container must first be deleted before the container can be deleted.

Any user with the Service Administrator role can perform this task.

You can delete containers by using the following interfaces:
Interface Resources

Web Console

(Not available on Oracle Cloud at Customer)
See Deleting a Container Using the Web Console.

RESTful API

See Delete Container in REST API for Standard Storage in Oracle Cloud Infrastructure Object Storage Classic.

Java Library

See deleteContainer in Java API Reference for Oracle Cloud Infrastructure Object Storage Classic.

File Transfer Manager CLI

See Deleting Containers in Command-Line Reference for Oracle Cloud Infrastructure Object Storage Classic.

File Transfer Manager API

See deleteContainer in Java API Reference for Oracle Cloud Infrastructure Object Storage Classic File Transfer Manager.

For information about deleting multiple objects in a container in a single operation, see Bulk-Deleting Objects.

Deleting a Container Using the Web Console

(Not available on Oracle Cloud at Customer)
  1. Sign in to the Oracle Cloud Infrastructure Object Storage Classic console.

    The list of containers is displayed.

  2. Identify the container that you want to delete.
  3. Click delete on the left side of the container name.

    The delete button is displayed only for empty containers.

    The following message appears:

    Are you sure want to delete this container?

  4. Click OK.

    The container is deleted.

Deleting a Container Using the REST API

All objects within a container must first be deleted before the container can be deleted. To find out whether a container contains any objects, send a HEAD request to the container URL.

cURL Command Syntax

curl -v -X DELETE \
     -H "X-Auth-Token: token" \
     accountURL/containerName

Note:

When you send a REST API request to Oracle Cloud Infrastructure Object Storage Classic, all non-ASCII characters in container names, object names and metadata values must be URL-encoded. For example, my container should be encoded as my%20container, where %20 is the HTML encoding for the space character. Similarly, my Über Container should be encoded as my%20%C3%9Cber%20Container, where %20 represents the space character and %C3%9C is the Ü character.

HTTP Response Codes

cURL Command Examples

Sample Cloud account with the following details:
  • Account name: acme
  • REST Endpoint URL: https://acme.storage.oraclecloud.com/v1/Storage-acme
  • REST Endpoint (Permanent) URL: https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365

    Note:

    The REST Endpoint (Permanent) is displayed for the accounts created after November 2017.
  • Using the REST Endpoint URL obtained from the REST Endpoint field in the My Services dashboard:
    curl -v -X DELETE \
         -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \
         https://acme.storage.oraclecloud.com/v1/Storage-acme/FirstContainer
    
    The following is an example of the output of this command:
    > DELETE /v1/Storage-acme/FirstContainer HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host: acme.storage.oraclecloud.com
    > Accept: */*
    > X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b
    >
    < HTTP/1.1 204 No Content
    < Date: Fri, 06 Mar 2015 10:43:38 GMT
    < Content-Length: 0
    < Content-Type: text/html; charset=UTF-8
    < X-Trans-Id: txc100a7408d564f82916fb-0054f984da
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Content-Language: en
    <
    
  • Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field in the My Services dashboard:

    Note:

    This cURL command example applies to the accounts created after November 2017.
    curl -v -X DELETE \
         -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \
         https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365/FirstContainer
    
    The following is an example of the output of this command:
    > DELETE /v1/Storage-7b16fede61e1417ab83eb52e06f0e365/FirstContainer HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host: storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com
    > Accept: */*
    > X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b
    >
    < HTTP/1.1 204 No Content
    < Date: Fri, 06 Mar 2015 10:43:38 GMT
    < Content-Length: 0
    < Content-Type: text/html; charset=UTF-8
    < X-Trans-Id: txc100a7408d564f82916fb-0054f984da
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Content-Language: en
    <