As you may recall, containers are collections of objects (files).

As such, there are some operations that can be performed on/with containers to manage them.

All requests mentioned here require authentication.

Container URLs

Aside from list operations, all operations operate on the container URL, which follows the format of Storage URL (X-Storage-Url) and container (i.e. <X-Storage-Url>/<container name>).

Creating Containers

Container creation is performed via a PUT request on the desired Container URL.

Below, a new container named newcontainer is created.

# BEGIN REQUEST #
PUT /v1/AUTH_NetFire$example/newcontainer HTTP/1.1
Host: us-east1.swift.netfire.com
X-Auth-Token: [REDACTED]
Content-Length: 0
User-Agent: python-swiftclient-4.3.0
# END REQUEST #

# BEGIN RESPONSE #
HTTP/1.1 201 Created
Content-Length: 0
X-Trans-Id: tx0000056198a5c7530b326-006517ec06-988dd5-us-east1
X-Openstack-Request-Id: tx0000056198a5c7530b326-006517ec06-988dd5-us-east1
Accept-Ranges: bytes
Content-Type: text/plain; charset=utf-8
Date: Sat, 30 Sep 2023 09:36:06 GMT
Connection: close
# END RESPONSE #

Deleting Containers

Container deletion is performed via a DELETE request on the Container URL. Below, a container named newcontainer is deleted.

# BEGIN REQUEST #
DELETE /v1/AUTH_NetFire$example/newcontainer HTTP/1.1
Host: us-east1.swift.netfire.com
X-Auth-Token: [REDACTED]
User-Agent: python-swiftclient-4.3.0
Content-Length: 0
# END REQUEST #

# BEGIN RESPONSE #
HTTP/1.1 204 No Content
X-Trans-Id: tx00000d5d6448675040e35-006517ed59-988dd5-us-east1
X-Openstack-Request-Id: tx00000d5d6448675040e35-006517ed59-988dd5-us-east1
Accept-Ranges: bytes
Content-Type: text/plain; charset=utf-8
Date: Sat, 30 Sep 2023 09:41:45 GMT
Connection: close
# END RESPONSE #

Listing Containers

Containers can be listed by performing a GET request against your Storage URL (X-Storage-Url).

It can be limited to N number of results via the URL query parameter limit=N.

The response's body formatting can be controlled with a format=FMT URL query parameter, where FMT is one of either json (the default) or xml. (Examples of both are provided below.)

Pagination

To perform pagination, use the limit URL query parameter above with a marker=NAME URL query parameter, where NAME is the name of the last container in the previous set of results. Leave marker unspecified to fetch the first "page".

📘

It is always a good idea to make a followup request with marker!

For performance reasons, NetFire Cloud Storage may limit the number of results if they're particularly large. Always checking for an empty result using marker and ending your iteration only if it is empty will ensure that you have gotten every last result.

If there are no more results after marker=NAME, then the response body will be an empty array:

  • [] if format=json
  • a childless /container root element if format=xml, e.g.:
    • <?xml version="1.0" encoding="UTF-8"?>
      <container name="containername">
      </container>
      

JSON

# BEGIN REQUEST #
GET /v1/AUTH_NetFire$example?format=json HTTP/1.1
Host: us-east1.swift.netfire.com
X-Auth-Token: [REDACTED]
User-Agent: python-swiftclient-4.3.0
# END REQUEST #

# BEGIN RESPONSE #
HTTP/1.1 200 OK
X-Timestamp: 1696067669.74850
X-Account-Container-Count: 2
X-Account-Object-Count: 8
X-Account-Bytes-Used: 1048356
X-Account-Bytes-Used-Actual: 1069056
X-Account-Storage-Policy-Default-Placement-Container-Count: 2
X-Account-Storage-Policy-Default-Placement-Object-Count: 8
X-Account-Storage-Policy-Default-Placement-Bytes-Used: 1048356
X-Account-Storage-Policy-Default-Placement-Bytes-Used-Actual: 1069056
X-Account-Meta-Quota-Bytes: 10737418240
X-Account-Meta-Quota-Count: 1200
Accept-Ranges: bytes
X-Trans-Id: tx00000dbd6b5046ab512c9-006517f055-988dc3-us-east1
X-Openstack-Request-Id: tx00000dbd6b5046ab512c9-006517f055-988dc3-us-east1
Content-Type: application/json; charset=utf-8
Content-Length: 90
Date: Sat, 30 Sep 2023 09:54:29 GMT
Connection: close

## BEGIN RESPONSE BODY ##
[{"name":"example","count":8,"bytes":1048356},{"name":"newcontainer","count":0,"bytes":0}]
## END RESPONSE BODY ##
# END RESPONSE #

"Prettified" response body:

[
  {
    "name": "example",
    "count": 8,
    "bytes": 1048356
  },
  {
    "name": "newcontainer",
    "count": 0,
    "bytes": 0
  }
]

XML

# BEGIN REQUEST #
GET /v1/AUTH_NetFire$example?format=xml HTTP/1.1
Host: us-east1.swift.netfire.com
X-Auth-Token: [REDACTED]
User-Agent: python-swiftclient-4.3.0
# END REQUEST #

# BEGIN RESPONSE #
HTTP/1.1 200 OK
X-Timestamp: 1696067669.83417
X-Account-Container-Count: 2
X-Account-Object-Count: 8
X-Account-Bytes-Used: 1048356
X-Account-Bytes-Used-Actual: 1069056
X-Account-Storage-Policy-Default-Placement-Container-Count: 2
X-Account-Storage-Policy-Default-Placement-Object-Count: 8
X-Account-Storage-Policy-Default-Placement-Bytes-Used: 1048356
X-Account-Storage-Policy-Default-Placement-Bytes-Used-Actual: 1069056
X-Account-Meta-Quota-Bytes: 10737418240
X-Account-Meta-Quota-Count: 1200
Accept-Ranges: bytes
X-Trans-Id: tx0000093a5e71a13397e81-006517f055-988dcc-us-east1
X-Openstack-Request-Id: tx0000093a5e71a13397e81-006517f055-988dcc-us-east1
Content-Type: application/xml; charset=utf-8
Content-Length: 233
Date: Sat, 30 Sep 2023 09:54:29 GMT
Connection: close

## BEGIN RESPONSE BODY ##
<?xml version="1.0" encoding="UTF-8"?><account name="Example"><container><name>example</name><count>8</count><bytes>1048356</bytes></container><container><name>newcontainer</name><count>0</count><bytes>0</bytes></container></account>
## END RESPONSE BODY ##
# END RESPONSE #

"Prettified" response body:

<?xml version="1.0" encoding="UTF-8"?>
<account name="Example">
  <container>
    <name>example</name>
    <count>8</count>
    <bytes>1048356</bytes>
  </container>
  <container>
    <name>newcontainer</name>
    <count>0</count>
    <bytes>0</bytes>
  </container>
</account>