Getting Container Metadata

Any user with the Service Administrator role or a role that is specified in the X-Container-Read ACL of the container can perform this task.

You can retrieve information about an object in a container by sending a HEAD request, which returns the following information:

  • Container ACLs (X-Container-Read and X-Container-Write)
  • Container quotas: (X-Container-Meta-Quota-Count and X-Container-Meta-Quota-Bytes)
  • Number of objects in the container (X-Container-Object-Count)
  • Storage space used by all objects in the container, in bytes (X-Container-Bytes-Used)
  • Custom metadata (X-Container-Meta-Name)
  • Storage class of the container (X-Storage-Class), returned only for Archive containers
You can view the container metadata by using the following interfaces:
Interface Resources

Oracle Cloud Infrastructure Object Storage Classic Console

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

RESTful API

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

File Transfer Manager API

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

File Transfer Manager CLI

See Getting Container Metadata in Command-Line Reference for Oracle Cloud Infrastructure Object Storage Classic.

Getting Container Metadata Using the Web Console

(Not available on Oracle Cloud at Customer)
  1. Sign in to the Oracle Cloud Infrastructure Object Storage Classic console.
  2. Select a container from the list. Expand Container Information pane for the container.

    The details of the container are displayed in the Container Information pane.

Getting Container Metadata Using the REST API

cURL Command Syntax

curl -v -X HEAD \
     -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) URL is displayed for the accounts created after November 2017.
  • Using the REST Endpoint URL obtained from the REST Endpoint field:
    curl -v -X HEAD \
         -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 for a Standard container:

    > HEAD /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 11:40:11 GMT
    < X-Container-Object-Count: 0
    < X-Container-Write: Storage-acme.Storage.Storage_ReadWriteGroup,Storage-acme.myCustomRole
    < X-Container-Meta-Category: Books
    < Accept-Ranges: bytes
    < X-Container-Meta-Quota-Count: 100
    < X-Timestamp: 1425639066.56315
    < X-Container-Read: .r:*,.rlistings
    < X-Container-Bytes-Used: 0
    < Content-Type: text/plain; charset=utf-8
    < X-Container-Meta-Quota-Bytes: 10737418240
    < X-Trans-Id: txb0b9882eceba45b287266-0054f9921b
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Content-Language: en
    

    For an Archive container, the header X-Storage-Class displays the value Archive in the metadata. The following is an example of this command:

    > HEAD /v1/Storage-acme/firstArchiveContainer1 HTTP/1.1
    > User-Agent: curl/7.29.0
    > Host: acme.storage.oraclecloud.com:443
    > Accept: */*
    > X-Auth-Token: AUTH_tk32486a5bbed54ee74213a30d6d128f9d
    >
    < HTTP/1.1 204 No Content
    < X-Container-Object-Count: 0
    < X-Container-Write: cloudua001.Storage.Storage_ReadWriteGroup
    < Accept-Ranges: bytes
    < X-Timestamp: 1434733473.12286
    < X-Container-Read: cloudua001.Storage.Storage_ReadOnlyGroup,cloudua001.Storage.Storage_ReadWriteGroup
    < X-Container-Bytes-Used: 0
    < X-Trans-Id: txfcffc30b5a0c44cb91491-005584544ega
    < Date: Fri, 19 Jun 2015 17:41:34 GMT
    < X-Storage-Class: Archive
    < Content-Type: text/plain;charset=utf-8
    
  • Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field:

    Note:

    This cURL command example applies to the accounts created after November 2017.
    curl -v -X HEAD \
         -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 for a Standard container:

    > HEAD /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 11:40:11 GMT
    < X-Container-Object-Count: 0
    < X-Container-Write: Storage-7b16fede61e1417ab83eb52e06f0e365.Storage.Storage_ReadWriteGroup,Storage-7b16fede61e1417ab83eb52e06f0e365.myCustomRole
    < X-Container-Meta-Category: Books
    < Accept-Ranges: bytes
    < X-Container-Meta-Quota-Count: 100
    < X-Timestamp: 1425639066.56315
    < X-Container-Read: .r:*,.rlistings
    < X-Container-Bytes-Used: 0
    < Content-Type: text/plain; charset=utf-8
    < X-Container-Meta-Quota-Bytes: 10737418240
    < X-Trans-Id: txb0b9882eceba45b287266-0054f9921b
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Content-Language: en
    

    For an Archive container, the header X-Storage-Class displays the value Archive in the metadata. The following is an example of this command:

    > HEAD /v1/Storage-7b16fede61e1417ab83eb52e06f0e365/firstArchiveContainer1 HTTP/1.1
    > User-Agent: curl/7.29.0
    > Host: storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com:443
    > Accept: */*
    > X-Auth-Token: AUTH_tk32486a5bbed54ee74213a30d6d128f9d
    >
    < HTTP/1.1 204 No Content
    < X-Container-Object-Count: 0
    < X-Container-Write: cloudua001.Storage.Storage_ReadWriteGroup
    < Accept-Ranges: bytes
    < X-Timestamp: 1434733473.12286
    < X-Container-Read: cloudua001.Storage.Storage_ReadOnlyGroup,cloudua001.Storage.Storage_ReadWriteGroup
    < X-Container-Bytes-Used: 0
    < X-Trans-Id: txfcffc30b5a0c44cb91491-005584544ega
    < Date: Fri, 19 Jun 2015 17:41:34 GMT
    < X-Storage-Class: Archive
    < Content-Type: text/plain;charset=utf-8