16.11.2014 Views

ESU REST API Guide.book - EMC Community Network

ESU REST API Guide.book - EMC Community Network

ESU REST API Guide.book - EMC Community Network

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>EMC</strong> STORAGE UTILITY<br />

<strong>REST</strong> <strong>API</strong> <strong>Guide</strong><br />

Version 1.0<br />

Revision A<br />

<strong>EMC</strong> CORPORATION<br />

Corporate Headquarters:<br />

Hopkinton, MA 01748-9103<br />

1-508-435-1000<br />

www.<strong>EMC</strong>.com


© 2009 <strong>EMC</strong> Corporation. All rights reserved.<br />

<strong>EMC</strong> believes the information in this publication is accurate as of its publication date. The information is subject to<br />

change without notice.<br />

The information in this publication is provided “as is.” <strong>EMC</strong> Corporation makes no representations or warranties of any<br />

kind with respect to the information in this publication, and specifically disclaims implied warranties of merchantability<br />

or fitness for a particular purpose.<br />

Use, copying, and distribution of any <strong>EMC</strong> software described in this publication requires an applicable software license.<br />

<strong>EMC</strong> is a registered trademark. All other trademarks used herein are the property of their respective owners.<br />

2


Contents<br />

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

Typographic Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

1 <strong>REST</strong> Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6<br />

Service Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6<br />

Common Rest Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />

Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

Managing Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />

Enabling Object Access Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />

Object Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />

User-defined Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />

System-defined Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15<br />

2 <strong>REST</strong> <strong>API</strong> Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />

POST Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />

CreateObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />

SetACL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />

SetUserMetadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />

VersionObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />

GET Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21<br />

GetACL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />

GetListableTags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />

GetSystemMetadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

GetUserMetadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />

ListObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />

ListUserMetadataTags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />

ListVersions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />

ReadObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />

HEAD Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />

PUT Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />

UpdateObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />

DELETE Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />

DeleteObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />

DeleteUserMetadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />

3


A <strong>REST</strong> Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31<br />

Contents 4


Preface<br />

This document explains how to use the <strong>EMC</strong> ® Storage Utility (<strong>ESU</strong>) web service to create objects and<br />

manage their related metadata.<br />

Documentation<br />

The following documents comprise the <strong>EMC</strong> Storage Utility documentation set.<br />

Document Description Intended Audience<br />

<strong>EMC</strong> Storage Utility User<br />

<strong>Guide</strong><br />

Describes aspects of the portal<br />

including how to register for the<br />

service, and how to use the<br />

authentication keys:<br />

Any customer preparing to use<br />

the <strong>EMC</strong> Storage Utility portal.<br />

<strong>EMC</strong> Storage Utility Quick<br />

Start <strong>Guide</strong><br />

http://preview.emccis.com/downloads/esu_ug.pdf<br />

Explains a fast track approach to<br />

using the web service:<br />

Any developer preparing to use<br />

the <strong>EMC</strong> Storage Utility portal.<br />

http://preview.emccis.com/downloads/esu_qs.pdf<br />

Typographic Conventions<br />

The following conventions are used in this guide:<br />

Conventions<br />

Blue text<br />

FixedWidth<br />

FixedWidthBold<br />

FixedWidthItalics<br />

Meaning<br />

Hyperlinked cross reference or URL.<br />

Commands, filenames, and code examples<br />

Emphasis within code examples<br />

Variable names in text<br />

5


1 <strong>REST</strong> Web Service<br />

<strong>EMC</strong> ® Storage Utility is an object-storage system with enormous scalability and extensibility. It uses<br />

metadata-driven policies to manage data placement and data services.<br />

This guide describes the programmatic interfaces to store, retrieve, and edit objects, which can be any<br />

content type.<br />

Object creation and management can be done through <strong>REST</strong>-based Web services. The object interface<br />

supports metadata tagging, collection creation, version creation, and other advanced metadata<br />

operations. The <strong>API</strong>s described in this guide are used to manage objects and their metadata.<br />

There are two types of metadata:<br />

<br />

<br />

User metadata is a collection of text name-value pairs, which are not validated by the system. User<br />

metadata allows application developers the flexibility to create custom tags for data specific to the<br />

application they are developing.<br />

System metadata is automatically generated and is updated by the system based on a predefined<br />

schema.<br />

Features that are accessible using the web service include:<br />

<br />

<br />

Creating, reading, updating, and deleting objects.<br />

Managing object metadata defined in the data store.<br />

This chapter describes the principles on which the web service operates.<br />

Service Overview<br />

Use the web service for applications in which object data or metadata is passed to the system for storage<br />

management and retrieval.<br />

The service is based on a standard request and response model, as shown in the following diagram.<br />

You use HTTP methods like POST, DELETE, PUT, and GET to create, delete, update, and read objects and<br />

metadata.<br />

Web Client Interface<br />

Service Request<br />

Refresh<br />

Service Response<br />

Web Service<br />

6


Common Rest Headers<br />

The following table shows the common headers passed between the client and the server. Most<br />

object-service operations share common headers. For a list of the headers related to request and<br />

response transmissions, refer to each operation.<br />

Header<br />

x-emc-uid: subtenantid/userid<br />

x-emc-signature: signature<br />

Description<br />

The subtenantid and userid (UID) of an application<br />

that is consuming the <strong>API</strong>. Only one UID is allowed<br />

per request. The shared secret associated with this<br />

UID is used for signature generation. See “Managing<br />

Authentication.”<br />

The signature provides a means to authenticate the<br />

UID making the request. See “Algorithm for Securing<br />

<strong>REST</strong> Messages” for details on constructing this<br />

header.<br />

x-emc-date : Date_in_UTC_format Date format specified as Thu, 31 Jan 2009 19:37:28<br />

GMT, as defined in RFC 2616, section 3.3.1.<br />

Date : Date_in_UTC_format Date format specified as Thu, 31 Jan 2008 19:37:28<br />

GMT, as defined in RFC 2616, section 3.3.1.<br />

x-emc-useracl: uid1=Permission<br />

[,uid2=Permission...]<br />

x-emc-groupacl:groupname=Permission<br />

[,groupname=Permission...]<br />

x-emc-meta: name1=value1<br />

[,name2=value2...]<br />

x-emc-tags: tag1 [,tag2...]<br />

x-emc-listable-tags: tag1 [,tag2...]<br />

x-emc-listable-meta: name1=value1<br />

[,name2=value2...]<br />

Range: Bytes=beginOffset-endOffset<br />

A set of rights assigned to the object ID for the<br />

specified UID. This accepts multiple entries using the<br />

format described. UIDs must belong to the same<br />

subtenantid.<br />

Sets the rights assigned to the object ID for the user<br />

group. Only the group OTHER is supported; the Web<br />

server ignores all other groups.<br />

The name-value pairs that describe an object. The<br />

service permits up to 128 of these pairs in one<br />

request.<br />

This header can occur in the request and the response<br />

and can include up to 128 comma-separated values.<br />

See “ListObjects.”<br />

Specifies the name-value pairs that are listable for a<br />

given object. Listable refers to the context of a tag and<br />

whether an object is indexed by that tag. This header<br />

occurs only in response output.<br />

Specifies the name=value pair to be assigned to this<br />

listable tag. This tag is common to CreateObject,<br />

UpdateObject, and SetUserMetadata. It also occurs<br />

in the response output of GetUserMetadata.<br />

The beginning and ending offsets of an object on the<br />

server. This header appears only in the request<br />

payload of UpdateObject and ReadObject.<br />

1: <strong>REST</strong> Web Service Common Rest Headers 7


Content-Length:<br />

Content-Type:<br />

x-emc-delta:<br />

The length of the request/response body, in bytes.<br />

Used to get and set the content type of the object. If<br />

this is not specified, it defaults to<br />

application/octet-stream.<br />

Present only in the response from the server. The<br />

value of this header specifies the number of bytes by<br />

which the total disk space used by the user went up<br />

(positive number) or down (negative number) as a<br />

result of the operation.<br />

1: <strong>REST</strong> Web Service Common Rest Headers 8


Security<br />

Security for Web services consists of authentication using an encrypted signature model, and<br />

authorization through Access Control Lists (ACLs) at the user (UID) level.<br />

Managing Authentication<br />

The Web service uses a combination of the Token ID, and other request headers to produce a signature<br />

that authenticates the user accessing the web service. It uses a combination of various pieces of the<br />

message to validate the identity of the sender, integrity of the message, and non-repudiation of the<br />

action.<br />

The Token ID that you received via e-mail from the portal agent administrator consists of the subtenant<br />

ID, and the UID separated by a slash (/). The sub-tenant ID is a randomly generated, 32 character<br />

alphanumeric string, which is unique to each customer. The UID, however, is unique to a web-based<br />

application. The UID, which appears after the slash, is comprised of a portion of the customer name,<br />

and a randomly generated string. For example, if the customer name is 'ACME', then the UID string<br />

appends the additional random characters as shown below. The whole Token ID contains 53 uppercase<br />

characters including the slash, as shown in the following example:<br />

5f8442b515ec402fb4f39ffab8c8179a/ACME03GF52E8D8E581B5<br />

To complete the authentication operation, you must generate a signature using the shared secret, which<br />

is associated with the UID. The shared secret is a value generated by the <strong>EMC</strong> Storage Utility Agent<br />

responsible for managing this application. The shared secret appears in the same e-mail message that<br />

contains the Token ID. The following sample represents a typical shared secret:<br />

MBqhzSzhZJCQHE9U4RBK9ze3K7U=<br />

Without this information, your Web-service application cannot be authenticated by the server. Contact<br />

your <strong>EMC</strong> Storage Utility Agent, and request the UID and shared secret corresponding to your<br />

application. Note that the shared secret is in base64-encoded form. It needs to be base64 decoded before<br />

it can be used; see “Algorithm for Securing <strong>REST</strong> Messages” for additional information.<br />

The server retrieves the UID from the request and retrieves the shared secret associated with the UID<br />

stored on the server. The server then regenerates the signature using the same algorithm as the client. If<br />

this signature matches the one in the request, the web service processes the request and returns the<br />

response payload.<br />

ACLs further specify authorization of an action that may be taken on one or more objects. Specify the<br />

UID within the ACL header to establish access control. Note that a UID is restricted to the subtenantid<br />

established for the primary customer web service account.<br />

Algorithm for Securing <strong>REST</strong> Messages<br />

A client wanting to talk to the <strong>REST</strong> <strong>API</strong> composes the request and computes a hash of the request<br />

using the algorithm for securing <strong>REST</strong> messages. The UID is stored in a custom HTTP header, which is<br />

x-emc-uid and is a part of the request. Then, a signature is computed by applying HMAC-SHA1 on the<br />

hash and using the shared secret that maps to the UID in the request. This signature is appended to the<br />

request and sent to the web service for comparison.<br />

The header has the following format:<br />

1: <strong>REST</strong> Web Service Security 9


x-emc-signature : signature<br />

The signature is defined as:<br />

signature = Base64(HMACSHA1(HashString))<br />

where Base64 is the base64 encoding of the argument and HMACSHA1 is the keyed hash of the argument.<br />

The shared secret is used for computing the HMAC-SHA1. The actual shared secret is in binary format.<br />

This binary array of bytes is converted to a human-readable format by base64-encoding it, and this<br />

encoded format is what a user receives from the <strong>EMC</strong> Storage Utility portal agent. Make sure the<br />

shared secret is base64-decoded before using it as an input to the HMAC-SHA1 algorithm to generate<br />

the signature.<br />

For example, here is some Ruby code:<br />

digest = HMAC.digest(Digest.new(SHA1), Base64.decode64(key), HashString)<br />

return Base64.encode64(digest.to_s()).chomp()<br />

SHA1 is defined above. key is the base64-encoded shared secret that the user receives. When you<br />

base64-encode a string, the resulting string may look like this: xxxxxxxxxxx\n. You must call the<br />

chomp() function to remove the \n character at the end of the result string.<br />

HashString is computed as follows:<br />

HTTPRequestMethod + '\n' +<br />

ContentType + '\n' +<br />

Range + '\n' +<br />

Date + '\n' +<br />

CanonicalizedResource + '\n' +<br />

Canonicalized<strong>EMC</strong>Headers<br />

where + is the concatenation operator.<br />

Components of HashString are described in the following table.<br />

Field<br />

HTTPRequestMethod<br />

Content-Type<br />

Range<br />

Date<br />

CanonicalizedResource<br />

Canonicalized<strong>EMC</strong>Headers<br />

Description<br />

One of the five HTTP method types, in uppercase: GET, POST, PUT,<br />

DELETE, HEAD.<br />

Content type, in lowercase. Only the value is used, not the header<br />

name. If a request does not include an HTTP body, this is an empty<br />

string.<br />

Range header, in lowercase. Only the value is used, not the header<br />

name. If a request does not include the range header, this is an empty<br />

string.<br />

Standard HTTP header, in UTC format. Only the date value is used,<br />

not the header name.<br />

Path portion of the HTTP request URI, in lowercase.<br />

Refer to the process below for canonicalizing <strong>EMC</strong> headers.<br />

1: <strong>REST</strong> Web Service Security 10


Canonicalization<br />

Canonicalization of <strong>EMC</strong> headers is done as follows:<br />

1 Remove any white space before and after the colon and at the end of the metadata value. Multiple<br />

white spaces embedded within a metadata value are replaced by a single white space. For example:<br />

Before canonicalization:<br />

After canonicalization:<br />

x-emc-meta: title=Mountain Dew<br />

x-emc-meta:title=Mountain Dew<br />

2 Convert all header names to lowercase.<br />

3 Sort the headers alphabetically.<br />

4 For headers with values that span multiple lines, convert them into one line by replacing any<br />

newline characters and extra embedded white spaces in the value.<br />

5 Concatenate all headers together, using newlines (\n) separating each header from the next one.<br />

There should be no terminating newline character at the end of the last header.<br />

Example<br />

input<br />

POST /rest/objects HTTP/1.1<br />

x-emc-listable-meta: part4/part7/part8=quick<br />

x-emc-meta: part1=buy<br />

accept: */*<br />

x-emc-useracl: UID1=FULL_CONTROL,UID2=WRITE<br />

date: Thu, 05 Jun 2008 16:38:19 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 05 Jun 2008 16:38:19 GMT<br />

x-emc-groupacl: other=NONE<br />

host: 10.5.115.118<br />

content-length: 4286<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

Example<br />

HashString<br />

POST<br />

application/octet-stream<br />

Thu, 05 Jun 2008 16:38:19 GMT<br />

/rest/objects<br />

x-emc-date:Thu, 05 Jun 2008 16:38:19 GMT<br />

x-emc-groupacl:other=NONE<br />

x-emc-listable-meta:part4/part7/part8=quick<br />

x-emc-meta:part1=buy<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-useracl:UID1=FULL_CONTROL,UID2=WRITE<br />

Note that there is a blank line included in the above example to account for the missing Range header.<br />

The resulting signature, which you add back into the request before sending, is:<br />

p/ram6MewqVWP8R64wT4bBy7Zmw=<br />

Enabling Object Access Control<br />

User-level authorization is achieved by using the x-emc-groupacl or x-emc-useracl custom headers<br />

to set the access control for objects. For the x-emc-useracl header, enter one or more of the UIDs that<br />

are defined for your system. UIDs serve a dual purpose with regard to security. The UID, by itself, also<br />

1: <strong>REST</strong> Web Service Security 11


is used to further extend access control and management of objects. In the case of user ACLs, the UID<br />

must belong to the same subtenant to which the requesting UID belongs. A UID created under a<br />

different subtenant will have no access to objects owned by the authenticating tenant.<br />

The following example shows the structure of a request for the SetACL method, which includes the<br />

header x-emc-useracl: UID1=FULL_CONTROL to specify full access control for the users in UID1. The<br />

example also includes group read attributes using x-emc-groupacl: other=READ for a given object.<br />

POST /rest/objects/5ca1ab1e0a05737604847ff1f7a26d04848167b63d9f?acl HTTP/1.1<br />

accept: */*<br />

x-emc-useracl: UID1=FULL_CONTROL<br />

date: Thu, 05 Jun 2008 16:38:23 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 05 Jun 2008 16:38:23 GMT<br />

x-emc-groupacl: other=READ<br />

host: 10.5.115.118<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: MDaCy5+1t7ZYdglRxpIOrF4K1hU=<br />

Response<br />

HTTP/1.1 200 OK<br />

Date: Thu, 05 Jun 2008 16:38:23 GMT<br />

Server: Apache/2.0.61 (rPath)<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

Object Management<br />

Objects are the basis of the system. They include a variety of binary types that may be stored on the<br />

system.<br />

The following table lists the operations and related HTTP methods that act on objects. For deleting,<br />

updating, reading, and versioning, you must include the object ID if you use the object URL or the<br />

filename if you use the file-system namespace URL. The table below indicates the operations that can be<br />

performed with either an object ID or a filename.<br />

In the table, the entries in the URI column are prefixed by http://dns_name_or_ip_address/rest<br />

Operation HTTP Method URI<br />

CreateObject POST /objects<br />

— OR —<br />

/namespace/filename<br />

DeleteObject DELETE /objects/objectID<br />

— OR —<br />

/namespace/filename<br />

ListVersions GET /objects/objectID?versions<br />

— OR —<br />

/namespace/filename<br />

1: <strong>REST</strong> Web Service Object Management 12


Operation HTTP Method URI<br />

GetACL GET/HEAD /objects/objectID?acl<br />

— OR —<br />

/namespace/filename?acl<br />

ListObjects GET/HEAD /objects<br />

ReadObject GET/HEAD /objects/objectID<br />

— OR —<br />

/namespace/filename<br />

SetACL POST /objects/objectID?acl<br />

— OR —<br />

/namespace/filename?acl<br />

UpdateObject PUT /objects/objectID<br />

— OR —<br />

/namespace/filename<br />

VersionObject POST /objects/objectID<br />

— OR —<br />

/namespace/filename<br />

Metadata Management<br />

The Web service manages metadata associated with objects using the operations described in the table<br />

below. An object ID is required for most metadata operations. You specify the type of metadata<br />

operation in the URI of the request. All metadata tags used in these operations are case-sensitive.<br />

The following table lists the operations that act on metadata, and their related HTTP methods. As<br />

above, you must include the object ID if you use the <strong>REST</strong> object URL or the file path if you use the<br />

<strong>REST</strong> namespace URL. The table indicates the operations that can be performed with either an object ID<br />

or a filename.<br />

The entries in the URI column are prefixed by http://dns_name_or_ip_address/rest.<br />

Operation HTTP Method URI<br />

DeleteUserMetadata DELETE /objects/objectID?metadata/user<br />

— OR —<br />

/namespace/filename?metadata/user<br />

GetListableTags GET/HEAD /objects/listabletags<br />

— OR —<br />

/namespace/filename?listabletags<br />

GetSystemMetadata GET/HEAD /objects/objectID/metadata/system<br />

— OR —<br />

/namespace/filename?metadata/system<br />

GetUserMetadata GET/HEAD /objects/objectID?metadata/user<br />

— OR —<br />

/namespace/filename?metadata/user<br />

1: <strong>REST</strong> Web Service Object Management 13


Operation HTTP Method URI<br />

ListUserMetadataTags GET/HEAD /objects/objectID?metadata/tags<br />

— OR —<br />

/namespace/filename?metadata/tags<br />

SetUserMetadata POST /objects/objectID?metadata/user<br />

— OR —<br />

/namespace/filename?metadata/user<br />

The web service divides metadata into two categories: user defined and system defined.<br />

User-defined Metadata<br />

The <strong>REST</strong> Web service passes all metadata information as HTTP header name-value pairs. For<br />

metadata, only 128 tag-value pairs can be added. The total size of each individual HTTP header cannot<br />

exceed 8k.<br />

The <strong>REST</strong> Web service further specifies user-defined metadata using tag types. There are two types of<br />

metadata tags supported by the service:<br />

<br />

<br />

Metadata tags<br />

Listable metadata tags<br />

Metadata Tags<br />

Tags are a way of classifying an object. For example, a user who wants to assign tags that classify the<br />

photos he took on vacation might create tags called beach, hotel, restaurant, and so on. This section<br />

describes the various tag types you can use to classify object data. The x-emc-meta and x-emc-tags<br />

headers are used to refer to non-listable tags.<br />

The <strong>REST</strong> Web service uses the following object metadata tags:<br />

x-emc-meta: name = value — There can be only one of these headers, with up to 128<br />

comma-separated, name=value pairs. The name=value pair must appear to the right of the colon.<br />

x-emc-tags: tag1, tag2, tag3 — There can be only one of these headers, with up to 128<br />

comma-separated values.<br />

Listable Metadata Tags<br />

Users may choose to tag objects by one or more of the metadata names. The Listable<br />

x-emc-listable-meta HTTP header in the metadata struct tells the Web-service code to use the name from<br />

the metadata name=value pair to tag the object. This tagging can be done during either the<br />

CreateObject,UpdateObject, or the SetUserMetadata operations. In a sense, tags act like indices for<br />

an object. The same object can be tagged with multiple names; this is how tags differ from containers,<br />

as an object can belong to only one container. Note that these tags are private to the user who creates<br />

them; tags created by one user cannot be seen by another user.<br />

The ListObject operation can be used to retrieve a list of all objects tagged with a particular name. The<br />

tag name is specified using the x-emc-tags header.<br />

The <strong>REST</strong> Web service uses the following custom HTTP headers to refer to listable tags:<br />

1: <strong>REST</strong> Web Service Object Management 14


x-emc-listable-meta: name=value (requests and responses) — Indicates that the name from the<br />

specified metadata name=value pair is used or should be used to tag this object. This tag is<br />

common to the CreateObject, UpdateObject, and SetUserMetadata operations; it also occurs in<br />

the response output of GetUserMetadata.<br />

x-emc-listable-tags: name (responses only) — Indicates that the object is tagged by the<br />

specified name. This header occurs only in responses.<br />

The listable tag header can be used to introduce a hierarchy into the tag structure. The following<br />

example shows how the listable-meta tag is used to specify a tag hierarchy using the slash (/), as in<br />

part4/part7/part8=quick.<br />

POST /rest/objects HTTP/1.1<br />

x-emc-listable-meta: part4/part7/part8=quick<br />

x-emc-meta: part1=buy<br />

Users can use this functionality for easy indexing, searching, and retrieval of objects. For example, a<br />

user who wants to store pictures from a vacation taken in 2008 may want to tag the pictures with the<br />

tag vacation/2008. If he went on multiple vacations in 2008, he might want to further qualify the tags<br />

as, for instance, vacation/2008/paris or vacation/2008/china. Then, he can easily retrieve a list of<br />

all pictures from his 2008 China vacation by issuing a ListObjects operation and specifying<br />

vacation/2008/china as the input parameter.<br />

System-defined Metadata<br />

Most metadata service operations share common properties, which define the structure of each object.<br />

Refer to each method for its list of properties. System metadata, which describes attributes like change<br />

time and last access time, is another of these common attributes. You can retrieve the system-defined<br />

metadata for an object by querying the appropriate resource. This can be done by adding<br />

/metadata/system after the object ID in the URI. Specify the desired content to be returned using the<br />

following header:<br />

Request<br />

Response<br />

x-emc-tags: atime,uid<br />

x-emc-meta: atime = 2008-01-31T19:55:53Z<br />

x-emc-meta: uid=user1<br />

The following table explains the system metadata returned by the Web service.<br />

Name Example Description<br />

atime 2007-10-29T18:19:57Z Last access time<br />

mtime 2007-10-29T18:19:57Z Last modified time<br />

ctime 2007-10-29T18:19:56Z Change time<br />

uid Session User id (the owner)<br />

gid Apache Group ID<br />

itime 2007-10-29T18:19:56Z Inception time<br />

1: <strong>REST</strong> Web Service Object Management 15


Name Example Description<br />

type regular Type of the object. Could be either 'regular' or<br />

'directory'<br />

nlink 0 Number of links<br />

size 2971 Object size in bytes<br />

Request<br />

The following example shows the request input for the GetSystemMetadata operation. The suffix<br />

?metadata/system is appended to the end of the object ID.<br />

GET /rest/objects/5ca1ab1e0a05737604847ff1f7a26d04848167b63d9f?metadata/system<br />

HTTP/1.1<br />

accept: */*<br />

date: Thu, 05 Jun 2008 16:38:23 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 05 Jun 2008 16:38:23 GMT<br />

x-emc-tags: atime,uid<br />

host: 10.5.115.118<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 00NL3HHhyUXiRDTdWK52xqhQxTE=<br />

Response<br />

The response in this example returns the last access time and the UID for this object.<br />

HTTP/1.1 200 OK<br />

Date: Thu, 05 Jun 2008 16:38:23 GMT<br />

Server: Apache/2.0.61 (rPath)<br />

x-emc-meta: atime=2008-06-05T16:38:21Z, uid=user1<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

1: <strong>REST</strong> Web Service Object Management 16


2 <strong>REST</strong> <strong>API</strong> Reference<br />

This chapter describes how the various operations that act on object and metadata are mapped to HTTP<br />

methods.<br />

The <strong>EMC</strong> Storage Utility implements a standard <strong>REST</strong> interface to the Web service. The endpoint URL<br />

for the <strong>REST</strong> interface is http://ip_address/rest, with a suffix URI that describes the operation path.<br />

POST Methods<br />

POST methods enable creating objects, creating versions of existing objects, and setting user metadata<br />

and ACLs for specified objects. The following table provides the service operations associated with<br />

HTTP POST methods.<br />

Operation<br />

CreateObject<br />

SetACL<br />

SetUserMetadata<br />

VersionObject<br />

URI<br />

/objects<br />

— OR —<br />

/namespace/filename<br />

/objects/objectID?acl<br />

— OR —<br />

/namespace/filename /acl<br />

/objects/objectID?metadata/user<br />

— OR —<br />

/namespace/filename?metadata/user<br />

/objects/objectID<br />

— OR —<br />

/namespace/filename<br />

17


CreateObject<br />

This operation creates an object with optional ACL and user metadata. Once created, the object can be<br />

increased to any size; see “UpdateObject.” No validation is done on the metadata. The header content<br />

length is required to represent the size of the contents of the HTTP body, or the service will return an<br />

error. Appropriate system metadata is generated automatically.<br />

CreateObject also can be used to create directories. Directories can be created implicitly or explicitly:<br />

Implicitly — Specify the full path for an object, and the new director(y)ies is(are) are created<br />

automatically as needed, before creating the object itself.<br />

Explicitly — Use CreateObject and end the directory name with a forward slash (/). The request<br />

body must be empty.<br />

Request<br />

The request may include custom headers to specify metadata that assigns a tag name to the object and<br />

creates a listable tag with a name-value pair for indexing purposes. The example below also employs<br />

user and group ACL headers to specify access control for this newly created object.<br />

POST /rest/objects HTTP/1.1<br />

x-emc-listable-meta: part4/part7/part8=quick<br />

x-emc-meta: part1=buy<br />

accept: */*<br />

x-emc-useracl: UID1=FULL_CONTROL,UID2=WRITE<br />

date: Thu, 13 Nov 2008 16:59:57 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 16:59:57 GMT<br />

x-emc-groupacl: other=NONE<br />

host: 168.159.116.51<br />

content-length: 7584<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 7Nm52iT8gVcHbdX8fnbCwN+0vHI=<br />

Response<br />

The response payload contains the location header, which specifies the newly created object ID<br />

returned as a URI.<br />

HTTP/1.1 201 Created<br />

Date: Thu, 13 Nov 2008 16:59:57 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

location: /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc<br />

x-emc-delta: 7584<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

2: <strong>REST</strong> <strong>API</strong> Reference POST Methods 18


SetACL<br />

Use this operation to set the access control for this object. SetACL can be used for setting or resetting<br />

permissions. Either x-emc-groupacl or x-emc-useracl must be included, or the server will return an<br />

error. Submit a UID as the input string to the x-emc-useracl.<br />

Request<br />

Response<br />

POST /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc?acl HTTP/1.1<br />

accept: */*<br />

x-emc-useracl: UID1=FULL_CONTROL<br />

date: Thu, 13 Nov 2008 17:00:03 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:03 GMT<br />

x-emc-groupacl: other=READ<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: GS1M+BLkkjnWyuINcPoEypl4YlE=<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 17:00:03 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

SetUserMetadata<br />

The operation writes the metadata into the object. Either x-emc-listable-meta or x-emc-meta must<br />

be included in the request, or the server will return an error.<br />

Request<br />

Response<br />

POST /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc?metadata/user<br />

HTTP/1.1<br />

x-emc-listable-meta: part3=fast<br />

x-emc-meta: part1=order<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:00 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:00 GMT<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: PMhSeF4suQKnKoXPn8LvPCmQZNM=<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 17:00:00 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

VersionObject<br />

This operation creates a fixed (immutable) version of the object.<br />

N OTE: User metadata is copied from the specified object to its new version.<br />

2: <strong>REST</strong> <strong>API</strong> Reference POST Methods 19


Request<br />

Response<br />

POST /rest/objects/5ca1ab1e0a05737604847ff1f7a26d04848167b63d9f HTTP/1.1<br />

accept: */*<br />

date: Thu, 05 Jun 2008 16:38:20 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 05 Jun 2008 16:38:20 GMT<br />

host: 10.5.115.118<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: LUKVxeRojK0dVvmmem2MP45+FKU=<br />

The response payload contains the location header, which specifies the newly created object ID<br />

returned as a URI.<br />

HTTP/1.1 201 Created<br />

Date: Thu, 05 Jun 2008 16:38:20 GMT<br />

Server: Apache/2.0.61 (rPath)<br />

location: /rest/objects/5ca1ab1e0a05737604847ff1f7a26d04848167ca551e<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

2: <strong>REST</strong> <strong>API</strong> Reference POST Methods 20


GET Methods<br />

GET methods retrieve object data, including metadata, tags, and ACLs. The following table provides the<br />

service operations associated with HTTP GET method.<br />

Operation<br />

GetACL<br />

GetListableTags<br />

GetSystemMetadata<br />

GetUserMetadata<br />

ListObjects<br />

URI<br />

/objects/objectID?acl<br />

— OR —<br />

/namespace/filename?acl<br />

/objects/listabletags<br />

— OR —<br />

/namespace/filename?listabletags<br />

/objects/objectID?metadata/system<br />

— OR —<br />

/namespace/filename?metadata/system<br />

/objects/objectID?metadata/user<br />

— OR —<br />

/namespace/filename?metadata/user<br />

/objects<br />

ListUserMetadataTags<br />

ListVersions<br />

/objects/objectID?metadata/tags<br />

— OR —<br />

/namespace/filename?metadata/tags<br />

/objects/objectID?versions<br />

— OR —<br />

/namespace/filename<br />

ReadObject<br />

/objects/objectID<br />

— OR —<br />

/namespace/filename<br />

2: <strong>REST</strong> <strong>API</strong> Reference GET Methods 21


GetACL<br />

This operation returns the ACL details associated with the specified object ID.<br />

Request<br />

Response<br />

GET /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc?acl HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:03 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:03 GMT<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: su7QB2NQqTpY1thoVeIDio6HITM=<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 17:00:03 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

x-emc-groupacl: other=READ<br />

x-emc-useracl: UID1=FULL_CONTROL, UID2=WRITE, UID3=WRITE, UID4=FULL_CONTROL<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

GetListableTags<br />

This operation returns all listable tags under the specified input tag. For example, if an object is indexed<br />

by tag1 (in other words, tag1 is a listable tag for the object), tag1 is returned by this operation. If no tag<br />

is specified, it defaults to root, and all top-level tags are returned. Unlike all other operations, this<br />

operation is executed under the global namespace (not against an object).<br />

Request<br />

GET /rest/objects?listabletags HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 16:59:59 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 16:59:59 GMT<br />

x-emc-tags: part4<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: yJ96H4qKOwTG20aYbeqiL5vA/B0=<br />

The response payload returns all listable tags under the specified tag, as a comma-separated list.<br />

Response<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 16:59:59 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

x-emc-listable-tags: part7, part9<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

2: <strong>REST</strong> <strong>API</strong> Reference GET Methods 22


GetSystemMetadata<br />

This operation returns the system metadata for the object. Specify the tags of the pairs to be returned as<br />

comma-separated entries for the x-emc-tags header. The absence of a tag returns all pairs. The Web<br />

service supports up to nine system metadata name-value pairs. See “System-defined Metadata.”<br />

Request<br />

Response<br />

GET /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc?metadata/system HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:02 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:02 GMT<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 5LO2jZA5uTjB+EZlbI+0mSKLLDQ=<br />

The response returns each of the specified system-metadata types appended to the x-emc-meta header.<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 17:00:02 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

x-emc-meta: atime=2008-11-13T17:00:00Z, mtime=2008-11-13T16:59:58Z,<br />

ctime=2008-11-13T17:00:00Z, uid=user1, gid=apache, size=7584, nlink=0<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

GetUserMetadata<br />

This operation returns the metadata associated with the specified object, as a comma-separated list of<br />

name-value pairs. Specify the tags of the pairs to be returned as comma-separated tag names. To get all<br />

pairs, omit the tag names. Regular metadata is returned using the x-emc-meta header; listable<br />

metadata, the x-emc-listable-meta header.<br />

Request<br />

Response<br />

GET /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc?metadata/user HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:00 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:00 GMT<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: AhUc3SrvaP34JMZYWOrF7mrB/oY=<br />

The response payload returns metadata associated with the specified object as name-value pairs for the<br />

tags specified in the request.<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 17:00:00 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

x-emc-meta: part1=buy, part2=here, part3=now<br />

x-emc-listable-meta: part4/part7/part8=quick, part4/part9=slow<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

2: <strong>REST</strong> <strong>API</strong> Reference GET Methods 23


ListObjects<br />

This operation retrieves all object IDs indexed by a given tag. As mentioned earlier, listable tags are<br />

created in a user’s own namespace; hence, they are private to that user. Only objects belonging to the<br />

requesting UID are returned.<br />

Request<br />

Response<br />

GET /rest/objects HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:03 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:03 GMT<br />

x-emc-tags: part4/part7/part8<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 7ZK5oO3gfG6d+u0+mYvSFsb4Spo=<br />

The response contains an XML payload listing the object IDs for this user. The output corresponds to<br />

the tag supplied in the request payload. Object IDs are 44 characters long, and there is no limit to how<br />

many objects you can store; therefore, it is possible to reach the limit for data in the HTTP header. As a<br />

result, the Web service returns the object IDs from a ListObjects operation into the XML body, not the<br />

header.<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 17:00:03 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

Connection: close<br />

Transfer-Encoding: chunked<br />

Content-Type: text/plain; charset=UTF-8<br />

<br />

<br />

491abe33a105736f0491ac237c55a50491b1c10a23c9<br />

491abe33a105736f0491ac237c55a50491b1c1f14814<br />

491abe33a105736f0491ac237c55a50491b1cc487deb<br />

491abe33a105736f0491ac237c55a50491b1d616b101<br />

491abe33a105736f0491ac237c55a50491b1d62598d0<br />

491abe33a105736f0491ac237c55a50491b1d630861b<br />

491abe33a105736f0491ac237c55a50491c1ff8179e9<br />

491abe33a105736f0491c2088492430491c2100899a7<br />

491abe33a105736f0491c2088492430491c2105ae450<br />

491abe33a105736f0491c2088492430491c210646da5<br />

<br />

2: <strong>REST</strong> <strong>API</strong> Reference GET Methods 24


ListUserMetadataTags<br />

This operation returns the user-defined metadata tags assigned to the object. Regular metadata is<br />

returned using the x-emc-tags header; listable metadata, the x-emc-listable-tags header.<br />

Request<br />

Response<br />

GET /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc?metadata/tags HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:02 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:02 GMT<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: iKix57OMoUoKvb9SbHz7S58Oe2Q=<br />

The response payload contains user-defined tags, including the set of listable tags that apply to the<br />

specified object.<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 17:00:02 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

x-emc-tags: part2<br />

x-emc-listable-tags: part3, part4/part7/part8, part4/part9<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

ListVersions<br />

This operation retrieves all objects in the versioning chain of the specified object, including itself.<br />

Versioned objects can also be used as the specified object to the ListVersions operation.<br />

Request<br />

Response<br />

GET /rest/objects/5ca1ab1e0a05737604847ff1f7a26d04848167b63d9f?versions HTTP/1.1<br />

accept: */*<br />

date: Thu, 05 Jun 2008 16:38:20 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 05 Jun 2008 16:38:20 GMT<br />

host: 10.5.115.118<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 2A3ybcg9UnyV6IODHY50H+BWKdI=<br />

This operation returns the object IDs of all versions of the specified object. Object IDs are 44 characters<br />

long. This list has as many object IDs as there are versions of the specified object.<br />

HTTP/1.1 200 OK<br />

Date: Thu, 05 Jun 2008 16:38:20 GMT<br />

Server: Apache/2.0.61 (rPath)<br />

Content-Length: 253<br />

Connection: close<br />

Content-Type: text/xml<br />

<br />

<br />

5ca1ab1e0a05737604847ff1f7a26d04848167b63d9f<br />

5ca1ab1e0a05737604847ff1f7a26d04848167ca551e<br />

<br />

2: <strong>REST</strong> <strong>API</strong> Reference GET Methods 25


ReadObject<br />

This operation returns the contents of the specified object, along with the associated user metadata,<br />

system metadata and access-control list. An optional Range header (see “Common Rest Headers”) can<br />

be used to read only part of the object rather than the entire object. If the Range header is specified, data<br />

from offset until offset+size is read and returned to the user. The default value of size=0 and a<br />

non-default value of offset returns the data from offset until size.<br />

Request<br />

Response<br />

GET /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 16:59:58 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 16:59:58 GMT<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 7ZaAUVi2rPMRy4XIOVmazof7jRQ=<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 16:59:58 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

Content-Length: 7584<br />

x-emc-groupacl: other=NONE<br />

x-emc-useracl: UID1=FULL_CONTROL, UID2=WRITE, UID3=FULL_CONTROL<br />

x-emc-meta: part1=buy, atime=2008-11-13T16:59:57Z, mtime=2008-11-13T16:59:57Z,<br />

ctime=2008-11-13T16:59:57Z, uid=UID3, gid=apache, size=7584, nlink=0<br />

x-emc-listable-meta: part4/part7/part8=quick<br />

Connection: close<br />

Content-Type: application/octet-stream<br />

2: <strong>REST</strong> <strong>API</strong> Reference GET Methods 26


HEAD Methods<br />

There is a HEAD method corresponding to each GET method. HEAD methods are very similar to GET<br />

methods. A HEAD request looks exactly like a GET request, except the method name is HEAD instead of<br />

GET. The response from the server is different with a HEAD method: there is no response body, only<br />

headers are returned. This is especially useful for ReadObject requests when one wants to retrieve the<br />

object's user metadata, system metadata, and access-control list but not the object itself.<br />

PUT Methods<br />

The following table lists the table PUT method for updating object attributes.<br />

Operation<br />

UpdateObject<br />

URI<br />

/objects/objectID<br />

— OR —<br />

/namespace/filename<br />

UpdateObject<br />

UpdateObject can be used for updating the contents of an object, including its metadata and ACLs.<br />

You can update just part of the object or the complete object. To update part of the object, use the Range<br />

header (see “Common Rest Headers”) to specify the offset and size.<br />

Use UpdateObject to change the size of an object using one of the following methods:<br />

<br />

<br />

To truncate an object to size=0, omit the Range header, and specify an empty request body.<br />

Truncating an object to size=0 leaves the objectID unchanged.<br />

To increase or decrease an object's size, omit the range header and attach the new<br />

object content to the request body.<br />

UpdateObject also can be used to add or modify existing metadata or ACLs; for example, metadata can<br />

be changed from listable to non-listable and vice versa.<br />

Request<br />

PUT /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc HTTP/1.1<br />

x-emc-listable-meta: part4/part9=slow<br />

x-emc-meta: part2=here<br />

accept: */*<br />

x-emc-useracl: UID1=WRITE<br />

date: Thu, 13 Nov 2008 16:59:58 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 16:59:58 GMT<br />

range: Bytes=10-29<br />

host: 168.159.116.51<br />

content-length: 20<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 4oZorU2nBQlADhq7fTMklstL1eU=<br />

2: <strong>REST</strong> <strong>API</strong> Reference HEAD Methods 27


Response<br />

HTTP/1.1 200 OK<br />

Date: Thu, 13 Nov 2008 16:59:58 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

x-emc-delta: 0<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

2: <strong>REST</strong> <strong>API</strong> Reference PUT Methods 28


DELETE Methods<br />

DELETE methods remove objects and metadata from the system. The following table provides the<br />

service operations associated with HTTP DELETEs.<br />

Operation<br />

DeleteObject<br />

DeleteUserMetadata<br />

URI<br />

/objects/objectID<br />

— OR —<br />

/namespace/filename<br />

/objects/objectID?metadata/user<br />

— OR —<br />

/namespace/filename?metadata/user<br />

DeleteObject<br />

This operation deletes the object that matches the ObjectID supplied in the URI. The operation also<br />

deletes associated metadata.<br />

Request<br />

Response<br />

DELETE /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:03 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:03 GMT<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 29AQTcYe428b0p0I/xI2X9oJyfM=<br />

HTTP/1.1 204 No Content<br />

Date: Thu, 13 Nov 2008 17:00:04 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

x-emc-delta: -7584<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

2: <strong>REST</strong> <strong>API</strong> Reference DELETE Methods 29


DeleteUserMetadata<br />

This operation deletes all user metadata with matching tags from the specified object. Specify the tags<br />

of the pairs to be deleted. System metadata can be neither deleted nor modified directly. The request<br />

must include the x-emc-tags, or the service returns an error.<br />

Request<br />

Response<br />

DELETE /rest/objects/491abe33a105736f0491c2088492430491c5d0d67efc?metadata/user HTTP/1.1<br />

accept: */*<br />

date: Thu, 13 Nov 2008 17:00:01 GMT<br />

content-type: application/octet-stream<br />

x-emc-date: Thu, 13 Nov 2008 17:00:01 GMT<br />

x-emc-tags: part1<br />

host: 168.159.116.51<br />

x-emc-uid: 6039ac182f194e15b9261d73ce044939/user1<br />

x-emc-signature: 5uuhZ+PetrdYmLWIWHFUZPWocHI=<br />

HTTP/1.1 204 No Content<br />

Date: Thu, 13 Nov 2008 17:00:01 GMT<br />

Server: Apache/2.0.63 (rPath)<br />

Content-Length: 0<br />

Connection: close<br />

Content-Type: text/plain; charset=UTF-8<br />

2: <strong>REST</strong> <strong>API</strong> Reference DELETE Methods 30


A<br />

<strong>REST</strong> Error Codes<br />

This appendix describes the error codes that are trapped and returned during Web service operations.<br />

When the operations are invoked using the <strong>REST</strong> interface and an exception occurs, the server returns<br />

an HTTP error, along with a detailed error message in the response body, which contains the error code<br />

and error description.<br />

HTTP/1.1 404 Not Found<br />

Date: Thu, 31 Jan 2008 20:03:24 GMT<br />

Server: Apache/2.0.61 (rPath)<br />

Content-Length: 131<br />

Connection: close<br />

Content-Type: text/xml<br />

<br />

<br />

1003<br />

The requested object was not found.<br />

<br />

The following table lists the Atmos error codes and corresponding HTTP Error codes.<br />

Error<br />

Code<br />

Error Message<br />

HTTP<br />

Status<br />

Code<br />

HTTP Status Description<br />

1001 The server encountered an internal error. Please try<br />

again.<br />

500 Internal Server Error<br />

1002 One or more arguments in the request were invalid. 400 Bad Request<br />

1003 The requested object was not found. 404 Not Found<br />

1004 The specified range cannot be satisfied. 416 Requested Range Not<br />

Satisfiable<br />

1005 One or more metadata tags were not found for the<br />

requested object.<br />

1006 Operation aborted because of a conflicting<br />

operation in process against the resource.<br />

400 Bad Request<br />

409 Conflict<br />

1007 The server is out of memory. 500 Internal Server Error<br />

1008 The requested resource was not found on the server. 400 Bad Request<br />

1009 The method specified in the request is not allowed<br />

for the resource identified.<br />

1010 The requested object size exceeds the maximum<br />

allowed upload/download size.<br />

1011 The specified object length does not match the<br />

actual length of the attached object.<br />

405 Method Not Allowed<br />

400 Bad Request<br />

400 Bad Request<br />

31


Error<br />

Code<br />

Error Message<br />

HTTP<br />

Status<br />

Code<br />

HTTP Status Description<br />

1012 The requested update size was greater than the size<br />

of the attached object.<br />

400 Bad Request<br />

1013 The server is out of disk space. 500 Internal Server Error<br />

1014 The maximum allowed metadata entries per object<br />

has been exceeded.<br />

1015 The request could not be finished due to insufficient<br />

access privileges.<br />

400 Bad Request<br />

401 Unauthorized<br />

1016 The resource you are trying to create already exists. 400 Bad Request<br />

1019 The server encountered an I/O error. Please try<br />

again.<br />

1020 A requested resource is missing or could not be<br />

found.<br />

500 Internal Server Error<br />

500 Internal Server Error<br />

1021 A requested resource is not a directory. 400 Bad Request<br />

1022 A requested resource is a directory. 400 Bad Request<br />

1023 A requested directory is not empty. 400 Bad Request<br />

1024 A requested resource is in an unstable state. 500 Internal Server Error<br />

1025 A network resource is disconnected or could not be<br />

reached.<br />

500 Internal Server Error<br />

1026 A cross device link was attempted to be created. 400 Bad Request<br />

1027 The client was uninitialized before the request was<br />

submitted.<br />

1028 The client was already initialized before the request<br />

was submitted.<br />

500 Internal Server Error<br />

500 Internal Server Error<br />

1029 The client could not be initialized. 500 Internal Server Error<br />

1031 The request timestamp was outside the valid time<br />

window.<br />

1032 There was a mismatch between the signature in the<br />

request and the signature as computed by the<br />

server.<br />

1033 Unable to retrieve the secret key for the specified<br />

principal.<br />

403 Forbidden<br />

403 Forbidden<br />

401 Unauthorized<br />

1034 Unable to read the contents of the HTTP body. 400 Bad Request<br />

1036 The specified offset was invalid. 400 Bad Request<br />

A: <strong>REST</strong> Error Codes 32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!