Rackspace Api

Rackspace provide a set of api , you can use by rest protocol, curl is a good tool suggested.

http://docs.rackspace.com/rcbu/api/v1.0/rcbu-devguide/content/Authentication-d1e647.html

  • First of all you need to obtain your username and apikey or password
  • after you need to obtain your authentication token

to obtain the authentication token you need a curl request to the the token endpoint, there are two token endpoint (us and uk ) but it's not important which you choose to use, the credential works in both

curl -X POST https://auth.api.rackspacecloud.com/v2.0/tokens -d '{ "auth":{ "RAX-KSKEY:apiKeyCredentials":{ "username":"myusername", "apiKey":"myapikey" } } }' -H "Content-type: application/json"

here http://docs.rackspace.com/rcbu/api/v1.0/rcbu-devguide/content/Authentication-d1e647.html either the other example with the password insteda of api key

from that request you obtain a long list of information,

{"access":{"token":{"id":"fgfgbb88c3e34433ea7e3ebba6gfgc7","expires":"2014-01-29T08:59:37.496Z","tenant":{"id":"123456","name":"123456"}

the most important are:
  • token id: long string that expire after 24 hours
  • id/name: are both the same number of six ciphers that identify your account, remain always the same

to test if all this correct you can do a first real request of a list of your server

curl -s https://servers.api.rackspacecloud.com/v1.0/123456/servers/detail  -H "X-Auth-Token: fgfgbb88c3e34433ea7e3ebba6gfgc7" | python -m json.tool

if you obtain some like this
{
    "servers": [
        {
            "addresses": {
                "private": [
                    "10.178.54.11"
                ], 
                "public": [
                    "198.101.228.60"
                ]
            }, 
            "flavorId": 2, 
            "hostId": "2d66db781ce490432f55ada17610173e", 
            "id": 21034274, 
            "imageId": 119, 
            "metadata": {
                "My Server Name": "API Test Server"
            },

and not an error code all works correctly.

There are two kind of request json and xml , I choose in my example to use the json format is more compact for the curl.

BACKUP

The Rackspace Cloud Backup Service is a regionalized service. So you must change the connection endpoint for the used region here a list of region and endpoints http://docs.rackspace.com/rcbu/api/v1.0/rcbu-devguide/content/Service_Access_Endpoints-d1e753.html

The doc for backup is here http://docs.rackspace.com/rcbu/api/v1.0/rcbu-devguide/content/operations.html begins from the chapter 3 the previous are of introduction.

Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License