Server

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
This operation will return details of a single server.
 
This operation will return details of a single server.
  
'''GET''' /servers/'''id'''
+
='''GET''' /servers/'''id'''=
 +
Get details of a single server.
  
 
== Parameters ==
 
== Parameters ==
Line 9: Line 10:
 
== Result ==
 
== Result ==
 
=== JSON ===
 
=== JSON ===
<big><source lang="javascript">
+
<nowiki>
 
{
 
{
 
   "server":{
 
   "server":{
Line 31: Line 32:
 
       "links":[
 
       "links":[
 
         {
 
         {
             "href":"http://{server_name}/servers/{server_id}/",
+
             "href":"http://{api_server}/servers/{server_id}/",
 
             "rel":"self"
 
             "rel":"self"
 
         }
 
         }
 
       ],
 
       ],
 
       "image":{
 
       "image":{
         "name":"Ubuntu 10.10 x64",
+
         "name":"{display_image_name}",
 
         "links":[
 
         "links":[
 
             {
 
             {
               "href":"http://{server_name}/images/20GB_Ubuntu%2010.10%20x64%20R1soft/",
+
               "href":"http://{api_server}/images/{image_id}/",
 
               "rel":"self"
 
               "rel":"self"
 
             }
 
             }
 
         ],
 
         ],
         "id":"20GB_Ubuntu 10.10 x64 R1soft"
+
         "id":"{image_id}"
 
       },
 
       },
 
       "userId":"{user_account_id}",
 
       "userId":"{user_account_id}",
Line 50: Line 51:
 
         "links":[
 
         "links":[
 
             {
 
             {
               "href":"http://{server_name}/flavors/3/",
+
               "href":"http://{api_server}/flavors/{flavor_id}/",
 
               "rel":"self"
 
               "rel":"self"
 
             }
 
             }
Line 68: Line 69:
 
   }
 
   }
 
}
 
}
</source></big>
+
</nowiki>
 
+
  
 
==== server ====
 
==== server ====
Line 88: Line 88:
  
 
; name - ''string''
 
; name - ''string''
: Descriptive name for this server.
+
: Display name for this server.
  
 
; created - ''string''
 
; created - ''string''
Line 153: Line 153:
  
 
== Examples ==
 
== Examples ==
'''GET {server_name}/servers/{server_id}'''
+
'''Successfully get server details'''
 +
:'''GET''' http(s)://{api_server}/servers/test_server_0013
  
 
''- Request Headers:''
 
''- Request Headers:''
Line 162: Line 163:
 
''- Response:''
 
''- Response:''
 
''OK (200)'':  
 
''OK (200)'':  
 +
<nowiki>
 
  {
 
  {
     "server": {
+
     "server":  
       "status": "ACTIVE",  
+
       {
      "updated": null,  
+
          "status": "ACTIVE",  
      "hostId": "hyperv05.vplex.net",  
+
          "updated": null,  
      "addresses": {
+
          "hostId": "{host_id}",  
          "public": [{
+
          "addresses":  
            "version": 4,  
+
            {
            "addr": "{ip_address}"}],  
+
                "public": [
          "private": [{
+
                  {
              "version": 4,  
+
                      "version": 4,  
              "addr":  "{ip_address}"}]},  
+
                      "addr": "{ip_address}"
      "links": [{
+
                  }
          "href": "<nowiki>http://{server_name}/servers/{server_id}/</nowiki>",  
+
                ],  
          "rel": "self"}],  
+
                "private": [
      "image": {
+
                  {
          "name": "CentOS 5 Plesk",  
+
                      "version": 4,  
          "links": [{"href": "<nowiki>http://{server_name}/images/Centos%205%20x86%20Plesk/</nowiki>", "rel": "self"}],  
+
                      "addr":  "{ip_address}"
          "id": "Centos 5 x86 Plesk" },  
+
                  }
      "userId": "{user_account_id}",  
+
                ]
      "flavor":  {"name": "", "links": [], "id": ""},  
+
            },  
      "id": "{server_id}",  
+
          "links": [
      "name": "{display_server_name}",  
+
            {
      "created": "2011-11-25T12:16:47",  
+
                "href": "http://{api_server}/servers/test_server_0013/",  
      "tenantId": null,  
+
                "rel": "self"
      "accessIPv4": "{ip_address}",  
+
            }
      "accessIPv6": null,  
+
          ],  
      "progress": 100,  
+
          "image": {
      "metadata": {}
+
            "name": "CentOS 5 Plesk",  
  }
+
            "links": [
 +
                {
 +
                  "href": "http://{api_server}/images/test_public_image/",  
 +
                  "rel": "self"
 +
                }
 +
            ],  
 +
            "id": "test_public_image"  
 +
          },  
 +
          "userId": "{user_account_id}",  
 +
          "flavor":  {"name": "", "links": [], "id": ""},  
 +
          "id": "test_server_0013",  
 +
          "name": "test_server_created",  
 +
          "created": "2011-11-25T12:16:47",  
 +
          "tenantId": null,  
 +
          "accessIPv4": "{ip_address}",  
 +
          "accessIPv6": null,  
 +
          "progress": 100,  
 +
          "metadata": {}
 +
    }
 
  }
 
  }
 
+
</nowiki>
 
* When a server is still pending (has not completed the provisioning process), the creation timestamp and hostId that are returned will be empty string.
 
* When a server is still pending (has not completed the provisioning process), the creation timestamp and hostId that are returned will be empty string.
  
 
+
'''Failure while trying to get server details without proper authorization'''
 
''- Response:''
 
''- Response:''
 
''Unauthorized (401)'':  
 
''Unauthorized (401)'':  
Line 205: Line 225:
 
     does not understand how to supply the credentials required.
 
     does not understand how to supply the credentials required.
  
 +
'''Failure while trying to get server details for non-existent server id'''
 
''- Response:''
 
''- Response:''
 
''ItemNotFound (404)'':  
 
''ItemNotFound (404)'':  
    {"itemNotFound": {"message": "Resource not found", "code": 404, "details": ""}}
+
{
 +
    "itemNotFound":  
 +
      {
 +
          "message": "Resource not found",  
 +
          "code": 404,  
 +
          "details": ""
 +
      }
 +
}
 +
 
 +
='''PUT''' /servers/'''id'''=
 +
Updates details info for a single server.
 +
 
 +
== Parameters ==
 +
; id - ''string''
 +
: Id of the server to update.
 +
 
 +
== Request==
 +
=== JSON ===
 +
<nowiki>
 +
{
 +
    "server" :
 +
      {
 +
          "name" : "{display_server_name}"
 +
      }
 +
}
 +
</nowiki>
 +
 
 +
====server====
 +
; name - ''string''
 +
: New display server name to update
 +
 
 +
== Response Codes ==
 +
; Success
 +
: ''HTTP/1.1 204 No Content''
 +
 
 +
; Failure
 +
: ''HTTP/1.1 401 Unauthorized'' : This server could not verify that you are authorized to access the document you requested.  Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
 +
: ''HTTP/1.1 404 Not Found'' : The resource requested is not found.
 +
 
 +
== Examples ==
 +
'''Successfully update the display name of the specific server'''
 +
:'''PUT''' http(s)://{api_server}/servers/123
 +
''Request Body:''
 +
{
 +
    "server" :
 +
      {
 +
          "name" : "test_server_name_updated"
 +
      }
 +
}
 +
 
 +
''Response Code:''
 +
<pre>HTTP/1.1 204 No Content</pre>
 +
 
 +
'''Failure updating a non-existent server'''
 +
:'''PUT''' http(s)://{api_server}/servers/{<span style="color:red">fake_server_id</span>}
 +
''Request Body:''
 +
{
 +
    "server" :
 +
      {
 +
          "name" : "test_server_name_updated"
 +
      }
 +
}
 +
 
 +
''Response Code:''
 +
<pre>HTTP/1.1 404 Not Found</pre>
 +
 
 +
='''DELETE''' /servers/'''id'''=
 +
Deletes a single server.
 +
 
 +
== Parameters ==
 +
; id - ''string''
 +
: Id of the server to delete.
 +
 
 +
== Response Codes ==
 +
; Success
 +
: ''HTTP/1.1 202 Accepted'' or ''HTTP/1.1 204 No Content''
 +
 
 +
; Failure
 +
: ''HTTP/1.1 401 Unauthorized'' : This server could not verify that you are authorized to access the document you requested.  Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
 +
: ''HTTP/1.1 404 Not Found'' : The resource requested is not found.
 +
 
 +
== Examples ==
 +
'''Successfully delete a specific server'''
 +
:'''DELETE''' http(s)://{api_server}/servers/123
 +
 
 +
''Response Code:''
 +
<pre>HTTP/1.1 202 Accepted</pre>
 +
 
 +
'''Failure updating a non-existent server'''
 +
:'''DELETE''' http(s)://{api_server}/servers/{<span style="color:red">fake_server_id</span>}
  
 +
''Response Code:''
 +
<pre>HTTP/1.1 404 Not Found</pre>
  
 
<!--  THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->
 
<!--  THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->

Revision as of 19:43, 23 April 2012

This operation will return details of a single server.

Contents

GET /servers/id

Get details of a single server.

Parameters

id - string
Id of the server to get.

Result

JSON

{
   "server":{
      "status":"ACTIVE",
      "updated":null,
      "hostId":"{host_id}",
      "addresses":{
         "public":[
            {
               "version":4,
               "addr":"{ip_address}"
            }
         ],
         "private":[
            {
               "version":4,
               "addr":"{ip_address}"
            }
         ]
      },
      "links":[
         {
            "href":"http://{api_server}/servers/{server_id}/",
            "rel":"self"
         }
      ],
      "image":{
         "name":"{display_image_name}",
         "links":[
            {
               "href":"http://{api_server}/images/{image_id}/",
               "rel":"self"
            }
         ],
         "id":"{image_id}"
      },
      "userId":"{user_account_id}",
      "flavor":{
         "name":"1024MB Server3",
         "links":[
            {
               "href":"http://{api_server}/flavors/{flavor_id}/",
               "rel":"self"
            }
         ],
         "id":3
      },
      "id":"{server_id}",
      "name":"{display_server_name}",
      "created":"2011-12-05T12:51:28",
      "tenantId":null,
      "accessIPv4":"{ip_address}",
      "accessIPv6":null,
      "progress":100,
      "metadata":{

      }
   }
}

server

id - string
Unique identifier for this server.
links - list
Hypermedia for this resource.
status - string
Current state of the server. Values: BUILD, ACTIVE, SUSPENDED, DELETED, UNKNOWN
hostId - string
Id of the physical host this virtual machine is running on.
userId - string
Unique identifier for the owner of this server.
name - string
Display name for this server.
created - string
The date and time this server was created. ISO 8601 format, YYYY-MM-DDTHH:MM:SS.
accessIPv4 - string
The default included public IPv4 address.
progress - number
The progress of the current this server while in the BUILD status. The value is in the range of 0 - 100, but currently will only even be 0, 50, 100.
metadata - object
Unused always an empty object.
tenantId
Unused always always null.
accessIPv6
Unused always null.
updated
Unused always null.

addresses

addresses.public.version - number
IP version of this address. Values: 4
addresses.public.addr = string
Public IP address of this server
addresses.private.version - number
IP version of this address. Values: 4
addresses.private.addr - string
Private IP address of this server

image

image.name - string
The display name of the image this server is based on.
image.links - list
Hypermedia for the image.
image.id - string
Unique identifier for image this server is based on.

flavor

flavor.name - string
The display name of the flavor this server is based on.
flavor.links - list
Hypermedia for the flavor.
flavor.id - string
Unique identifier for flavor this server is based on.

Response Codes

Success
OK (200)
Failure

-Unauthorized (401) : This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required. -ItemNotFound (404) : The resource requested is not found.


Examples

Successfully get server details

GET http(s)://{api_server}/servers/test_server_0013

- Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

- Response: OK (200):

 {
    "server": 
       {
          "status": "ACTIVE", 
          "updated": null, 
          "hostId": "{host_id}", 
          "addresses": 
             {
                "public": [
                   {
                      "version": 4, 
                      "addr": "{ip_address}"
                   }
                ], 
                "private": [
                   {
                      "version": 4, 
                      "addr":  "{ip_address}"
                   }
                ]
             }, 
          "links": [
             {
                "href": "http://{api_server}/servers/test_server_0013/", 
                "rel": "self"
             }
          ], 
          "image": {
             "name": "CentOS 5 Plesk", 
             "links": [
                {
                   "href": "http://{api_server}/images/test_public_image/", 
                   "rel": "self"
                }
             ], 
             "id": "test_public_image" 
          }, 
          "userId": "{user_account_id}", 
          "flavor":  {"name": "", "links": [], "id": ""}, 
          "id": "test_server_0013", 
          "name": "test_server_created", 
          "created": "2011-11-25T12:16:47", 
          "tenantId": null, 
          "accessIPv4": "{ip_address}", 
          "accessIPv6": null, 
          "progress": 100, 
          "metadata": {}
    }
 }

  • When a server is still pending (has not completed the provisioning process), the creation timestamp and hostId that are returned will be empty string.

Failure while trying to get server details without proper authorization - Response: Unauthorized (401):

    401 Unauthorized
    This server could not verify that you are authorized to
    access the document you requested.  Either you supplied the
    wrong credentials (e.g., bad password), or your browser
    does not understand how to supply the credentials required.

Failure while trying to get server details for non-existent server id - Response: ItemNotFound (404):

{
   "itemNotFound": 
      {
         "message": "Resource not found", 
         "code": 404, 
         "details": ""
      }
}

PUT /servers/id

Updates details info for a single server.

Parameters

id - string
Id of the server to update.

Request

JSON

 { 
    "server" : 
       {
          "name" : "{display_server_name}" 
       }
 }

server

name - string
New display server name to update

Response Codes

Success
HTTP/1.1 204 No Content
Failure
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 404 Not Found : The resource requested is not found.

Examples

Successfully update the display name of the specific server

PUT http(s)://{api_server}/servers/123

Request Body:

{ 
   "server" : 
      {
         "name" : "test_server_name_updated" 
      }
}

Response Code:

HTTP/1.1 204 No Content

Failure updating a non-existent server

PUT http(s)://{api_server}/servers/{fake_server_id}

Request Body:

{ 
   "server" : 
      {
         "name" : "test_server_name_updated" 
      }
}

Response Code:

HTTP/1.1 404 Not Found

DELETE /servers/id

Deletes a single server.

Parameters

id - string
Id of the server to delete.

Response Codes

Success
HTTP/1.1 202 Accepted or HTTP/1.1 204 No Content
Failure
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 404 Not Found : The resource requested is not found.

Examples

Successfully delete a specific server

DELETE http(s)://{api_server}/servers/123

Response Code:

HTTP/1.1 202 Accepted

Failure updating a non-existent server

DELETE http(s)://{api_server}/servers/{fake_server_id}

Response Code:

HTTP/1.1 404 Not Found


blog comments powered by Disqus


Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox