ARCDUS-kbdwl.jpg

canada goose vest kids store

Speedy REST API Example
Swift REST API Example

Last post I explained REST interfaces, and promised to use a Swift REST API as an example. This application programming interface (API) supports the following operations.

1) Swift REST API Authorization

This operation is used to obtain an authorization token and URL for a given user login and password. This token and URL are then used in any subsequent operations.

URL Data: None.

X-Auth-User = user login.

X-Auth-Key = user password.

Optional Request Headers: None.

Parameters: None.

Content-Length = always zero.

Date = current date.

X-Auth-Token = authorization token, input for subsequent operations.

X-Storage-Token = storage token, input for subsequent operations.

X-Storage-Url = storage URL, input for subsequent operations.

HTTP Data: None.

2) Swift REST API Account

Mark an account as deleted. Swift REST API will clean up the account as time permits.

URL Data: None.

X-Auth-Token = authorization token.

Optional Request Headers: None.

Parameters: None.

Content-Length = always zero.

Content-Type = http data content type.

Date = current date.

HTTP Data: None.

Get the list of containers in an account.

URL Data: None.

X-Auth-Token = authorization token.

Optional Request Headers: None.

format=type: return http data in “json” or “xml” format.

limit=number: limit the number of returned containers.

marker=filter: provide a filter. The returned list of containers will start after “filter”.

Accept-Ranges = always “bytes”. This header will eventually comply with the http “range” header.

Content-Length = the number of bytes in http data.

Content-Type = http data content type.

Date = current date.

X-Account-Bytes-Used = the number of bytes used in the account. Keep in mind that this field is updated in a lazy fashion.

X-Account-Container-Count = the number of containers in the account.

X-Account-Object-Count = the number of objects in the account. Keep in mind that this field is updated in a lazy fashion.

HTTP Data: The list of containers for the account.

Get account statistics.

URL Data: None.

X-Auth-Token = authorization token.

Optional Request Headers: None.

Parameters: None.

Accept-Ranges = always “bytes”. This header will eventually comply with the http “range” header.

Content-Length = always zero.

Content-Type = http data content type.

Date = current date.

X-Account-Bytes-Used = the number of bytes used in the account. Keep in mind that this field is updated in a lazy fashion.

X-Account-Container-Count = the number of containers in the account.


X-Account-Object-Count = the number of objects in the account. Keep in mind that this field is updated in a lazy fashion.

HTTP Data: None.

Post meta-data to an account.

URL Data: None.

X-Auth-Token = authorization token.

X-Account-Meta-* = the user can create a account meta-data header. Such headers are of the form: “key value”. The resulting account header will be: “X-Account-Meta-key: value”

Parameters: None.

Content-Length = always zero.

Content-Type = http data content type.

Date = current date.

HTTP Data: None.

Create an account.

URL Data: None.

X-Auth-Token = authorization token.

X-Account-Meta-* = the user can create a account meta-data header. Such headers are of the form: “key value”. The resulting account header will be: “X-Account-Meta-key: value”

Parameters: None.

Content-Length = always zero.

Content-Type = http data content type.

Date = current date.

HTTP Data: None.

3) Swift REST API Container

Mark a container as deleted. Swift will clean up the container as time permits.

URL Data: Container name.

X-Auth-Token = authorization token.

Optional Request Headers: None.

Parameters: None.

Content-Length = always zero.

Content-Type = http data content type.

Date = current date.

HTTP Data: None.

Get the list of objects in a container.

URL Data: Container name.

X-Auth-Token = authorization token.

Optional Request Headers: None.

delimiter=char: apply a character as a “delimiter” to the list of objects.

format=type: return http data in “json” or “xml” format.

limit=number: limit the number of returned objects.

marker=filter: provide a filter. The returned list of objects will start after “filter”.

path=string: for object names with embedded slashes (/).

prefix=string: The returned list of objects will start with “string”.

Accept-Ranges = always “bytes”. This header will eventually comply with the http “range” eader.

Content-Length = the number of bytes in http data.

Content-Type = http data content type.

Date = current date.

X-Container-Bytes-Used = the number of bytes used in the container.

X-Container-Object-Count = the number of objects in the container.

HTTP Data: The list of objects for the container.

Get container statistics.

URL Data: Container name.

X-Auth-Token = authorization token.

Optional Request Headers: None.

Parameters: None.

Accept-Ranges = always “bytes”.