Knowledge Base


« Object Store

CloudVPS Object Store QuickStart

In this quickstart you will find an example on the basis of curl. First some general information on the API.

API Information
 
Authentication Alternatives

More information on OpenStack Authentication can be found here.

Algemene HTTP + basic authentication:

Url   https://<$project_id>.objectstore.eu/
Gebruikersnaam   <$username>
Wachtwoord <$password>

Openstack token-based authentication:

Auth url: https://identity.stack.cloudvps.com/v2.0
Project id: <your project id>
Tenant id: <your project id>
Username: <your username>
Password: <your password>

Rackspace CloudFiles:

Authenticatie host  <$project_id>.objectstore.eu>
Gebruikersnaam  <$username>
Wachtwoord <$password>

Amazon S3:

Hostname  <$project_id>.objectstore.eu
Access key  <$ec2.access>
Secret Key  <$ec2.secret>

See our documentation on how to generate Amazone S3 access tokens.

API

The API uses HTTP REST calls (mainly GET, PUT and DELETE) in order to manage  objects. Structured data is being communicated in JSON-format. Here you can find more information about this API: http://docs.openstack.org/api/openstack-object-storage/1.0/content/.

Available Software Development Kits (SDKs) can be found here: https://wiki.openstack.org/wiki/SDKs. Our CloudVPS specific documentation for SDKs and other programming tools and languages can be found here: http://www.cloudvps.com/community/knowledge-base/category/object-store-dev-docs

CURL Example

In these examples we use the command line tool curl in order to show how the API works on the HTTP-level. In practice it is easier to use a library for your selected programming languages. For these examples you'll need your projectid, username and password. You can find these in the welcome email you received concerning your object store. In this example we'll use 'aaaa0000cccc66669999bbbb00004444' for the projectid, 'username' for the username and 'PaSsw0rd' for the password.

Containers

Objects within an object store will be assigned 'containers'. Containers can be seen as directories, the main difference being that there is only one hierarchical level; containers can only contain files, they can not contain other containers.

A container will be created with a simple PUT request.

curl -X PUT --user username:PaSsw0rd  \
https://aaaa0000cccc66669999bbbb00004444.objectstore.eu/photos/

The answer is a HTTP 202 (http://en.wikipedia.org/wiki/List_of_HTTP_status_codes):

202 Accepted
The request is accepted for processing.
Managing and retrieving objects

Now objects can be uploaded, this is also done via PUT:

curl -X PUT -T landscape.jpg --user username:PaSsw0rd  \
https://aaaa0000cccc66669999bbbb00004444.objectstore.eu/photos/landscape.jpg

The file is now stored in the object store, and can be retrieved from that:

curl --user username:PaSsw0rd  \
https://aaaa0000cccc66669999bbbb00004444.objectstore.eu/photos/landscape.jpg

Normally files can be retrieved with a valid token. In order to make files available publicly, a container can be designated as a public container:

curl -H "X-Container-Read: .r:*" -X PUT \
--user username:PaSsw0rd \
https://aaaa0000cccc66669999bbbb00004444.objectstore.eu/photos/

From this moment on files in that container can can be accessed by any browser. In this manner static files can be hosted directly from the object store.
If you want to retrieve an object from a public container using an URL, it would look like this:

https://aaaa0000cccc66669999bbbb00004444.objectstore.eu/photos/landscape.jpg

Files can be deleted with a DELETE request:

curl -X DELETE --user username:PaSsw0rd \
https://aaaa0000cccc66669999bbbb00004444.objectstore.eu/photos/landscape.jpg
VPS Bestellen
VPS Bestellen