# Object Keys

## What is an object key?

The **`object key`**(or key name) uniquely identifies the object in an OORT Storage bucket. **`Object metadata`** is a set of name-value pairs.&#x20;

When you create an object, you specify the key name, which uniquely identifies the object in the bucket. For example, on the OORT console, when you highlight a bucket, a list of objects in your bucket appears. These names are the **`object keys`**. The **`object key name`** is a sequence of Unicode characters with UTF-8 encoding of up to 1,024 bytes long.

<details>

<summary><strong>The</strong> OORT Storage <strong>data model is a flat structure</strong></summary>

You create a bucket, and the bucket stores objects. There is no hierarchy of subbuckets or subfolders. However, you can infer logical hierarchy using key name prefixes and delimiters as the OORT console does. In addition, the OORT console has support for folders.&#x20;

</details>

<details>

<summary>Suppose that your bucket (<code>admin-created</code>) has four objects with the following object keys</summary>

`Development/Projects.xls`

`Finance/statement1.pdf`

`Private/taxdocument.pdf`

`DSS-dg.pdf`

</details>

<details>

<summary>The console uses the key name prefixes (<code>Development/</code>, <code>Finance/</code>, and <code>Private/</code>) and delimiter ('/') to present a folder structure. The OORT Storage<code>-dg.pdf</code> key does not have a prefix, so its object appears directly at the root level of the bucket. If you open the <code>Development/</code> folder, you will see the <code>Projects.xlsx</code> object inside.</summary>

* [ ] Oortech DSS supports buckets and objects, which are not arranged hierarchically. However, the Oortech DSS console and the AWS SDKs can infer hierarchy and introduce the concept of folders from the prefixes and delimiters in an object key name.
* [ ] The Oortech DSS console implements folder object creation by creating a zero-byte object with the folder *prefix and delimiter* value as the key. These folder objects don't appear in the console. Otherwise they behave like any other objects and can be viewed and manipulated through the Oortech S3-Compatible API, AWS CLI, and AWS SDKs.

</details>

## Object naming rules

You can use any UTF-8 character in an object key name. However, using certain characters in key names can cause problems with some applications and protocols. The following guidelines help you maximize compliance with DNS, web-safe characters, XML parsers, and other APIs.

#### Safe characters <a href="#object-key-guidelines-safe-characters" id="object-key-guidelines-safe-characters"></a>

The following character sets are generally safe for use in key names.

| Alphanumeric characters | <ul><li>0-9</li><li>a-z</li><li>A-Z</li></ul>                                                                                                                                                                                                                                                                           |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Special characters      | <ul><li>Exclamation point (<code>!</code>)</li><li>Hyphen (<code>-</code>)</li><li>Underscore (<code>\_</code>)</li><li>Period (<code>.</code>)</li><li>Asterisk (<code>\*</code>)</li><li>Single quote (<code>'</code>)</li><li>Open parenthesis (<code>(</code>)</li><li>Close parenthesis (<code>)</code>)</li></ul> |

#### Characters that might require special handling <a href="#object-key-guidelines-special-handling" id="object-key-guidelines-special-handling"></a>

The following characters in a key name might require additional code handling and likely need to be URL encoded or referenced as HEX. Some of these are non-printable characters that your browser might not handle, which also requires special handling:

* Ampersand ("&")
* Dollar ("$")
* ASCII character ranges 00–1F hex (0–31 decimal) and 7F (127 decimal)
* 'At' symbol ("@")
* Equals ("=")
* Semicolon (";")
* Plus ("+")
* Space – Significant sequences of spaces might be lost in some uses (especially multiple spaces)
* Comma (",")
* Caret ("^")
* Left curly brace ("{")
* Right curly brace ("}")
* Percent character ("%")
* Grave accent / back tick ("\`")
* Right square bracket ("]")
* Left square bracket ("\[")
* Tilde ("\~")
* 'Pound' character ("#")

#### Characters to avoid <a href="#object-key-guidelines-avoid-characters" id="object-key-guidelines-avoid-characters"></a>

Avoid the following characters in a key name because of significant special handling for consistency across all applications.

* Forward slash ("/")
* Colon (":")
* Backslash ("\\")
* Question mark ("?")
* Vertical bar / pipe ("|")
* 'Greater Than' symbol (">")
* 'Less Than' symbol ("<")
* Quotation marks (""")
* Asterisk ("\*")
* Non-printable ASCII characters (128–255 decimal characters)

#### XML related object key constraints <a href="#object-key-xml-related-constraints" id="object-key-xml-related-constraints"></a>

As specified by the XML standard on end-of-line handling, all XML text is normalized such that single carriage returns (ASCII code 13) and carriage returns immediately followed by a line feed (ASCII code 10) are replaced by a single line feed character. To ensure the correct parsing of object keys in XML requests, carriage returns and other special characters must be replaced with their equivalent XML entity code when they are inserted within XML tags. The following is a list of such special characters and their equivalent entity codes:

* ' as `&apos;`
* ” as `&quot;`
* & as `&amp;`
* < as `&lt;`
* \> as `&gt;`
* \r as `&#13;` or `&#x0D;`
* \n as `&#10;` or `&#x0A;`

The following example illustrates the use of an XML entity code as a substitution for a carriage return. This `DeleteObjects` request deletes an object with the `key` parameter: `/some/prefix/objectwith\rcarriagereturn` (where the \r is the carriage return).

```
<Delete xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Object>
    <Key>/some/prefix/objectwith&#13;carriagereturn</Key>
  </Object>
</Delete>
```
