You can simulate a hierarchical structure in OpenStack Object Storage by following a few guidelines. Object names must contain the forward slash character / as a path element separator and also create directory marker objects; then they will be able to traverse this nested structure with the new path query parameter. This can best be illustrated by example:

[Note]Note

For the purposes of this example, the container where the objects reside is called backups. All objects in this example start with a prefix of photos and should NOT be confused with the container name. In the example, the full URI of the me.jpg file would be https://storage.swiftdrive.com/v1/CF_xer7_343/backups/photos/me.jpg


By combining this path query parameter with the format query parameter, users will be able to easily distinguish between virtual folders/directories by Content-Type and build interfaces that allow traversal of the pseudo-nested structure.

You can also use a delimiter parameter to represent a nested directory hierarchy without the need for the directory marker objects. You can use any single character as a delimiter. The listings can return virtual directories - they are virtual in that they don't actually represent real objects. like the directory markers, though, they will have a content-type of application/directory and be in a subdir section of json and xml results.

If you have the following objects—photos/photo1, photos/photo2, movieobject, videos/movieobj4—in a container, your delimiter parameter query using slash (/) would give you photos, movieobject, videos.

GET /v1/acct/container?delimiter=/
Host: storage.swiftdrive.com
X-Auth-Token: eaaafd18-0fed-4b3a-81b4-663c99ec1cbb