ServerList

(Difference between revisions)
Jump to: navigation, search
Line 11: Line 11:
  
 
; image - ''string''
 
; image - ''string''
: ''Optional'' Absolute URL of the image to filter servers by. ''e.g. <nowiki>http://127.0.0.1:6543/images/debian_lenny_template/</nowiki>''
+
: ''Optional'' Absolute URL of the image to filter servers by. ''e.g. <nowiki>http://{server_name}/images/debian_lenny_template/</nowiki>''
  
 
== Result ==
 
== Result ==
 
=== JSON ===
 
=== JSON ===
 
 
<big><source lang="javascript">
 
<big><source lang="javascript">
 
{
 
{
 
   "servers":[
 
   "servers":[
 
       {
 
       {
         "id":"michalski275226-AUS001-0005",
+
         "id":"{server_id}",
 
         "links":[
 
         "links":[
 
             {
 
             {
               "href":"http://127.0.0.1:6543/servers/michalski275226-AUS001-0005/",
+
               "href":"http://{server_name}/servers/{server_id}/",
 
               "rel":"self"
 
               "rel":"self"
 
             }
 
             }
Line 29: Line 28:
 
       },
 
       },
 
       {
 
       {
         "id":"michalski275226-AUS001-0001",
+
         "id":"{server_id}",
 
         "links":[
 
         "links":[
 
             {
 
             {
               "href":"http://127.0.0.1:6543/servers/michalski275226-AUS001-0001/",
+
               "href":"http://{server_name}/servers/{server_id}/",
 
               "rel":"self"
 
               "rel":"self"
 
             }
 
             }
Line 38: Line 37:
 
       },
 
       },
 
       {
 
       {
         "id":"michalski275226-AUS001-0003",
+
         "id":"{account_server_id}",
 
         "links":[
 
         "links":[
 
             {
 
             {
               "href":"http://127.0.0.1:6543/servers/michalski275226-AUS001-0003/",
+
               "href":"http://{server_name}/servers/{server_id}/",
 
               "rel":"self"
 
               "rel":"self"
 
             }
 
             }
Line 56: Line 55:
 
; links - ''array''
 
; links - ''array''
 
: [[Hypermedia]] for this resource.
 
: [[Hypermedia]] for this resource.
 +
 +
== Response Codes ==
 +
; Success:
 +
:''HTTP/1.1 200 OK''
 +
; Failure:
 +
:''HTTP/1.1 200 OK 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.
 +
 +
== Examples ==
 +
 +
'''List servers'''
 +
:'''GET''' <nowiki>http://{api_url}/servers</nowiki>
 +
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded username & password string
 +
 +
''Response Code:''
 +
<pre>HTTP/1.1 200 OK</pre>
 +
 +
''Response Body:''
 +
    {"servers":[
 +
    {"id": "{server_id}", "links": [{"href": "<nowiki>http://{server_name}/servers/{server_id}/</nowiki>", "rel": "self"}]},
 +
    {"id": "{server_id}", "links": [{"href": "<nowiki>http://{server_name}/servers/{server_id}/</nowiki>", "rel": "self"}]},
 +
    ...
 +
    {"id": "{server_id}", "links": [{"href": "<nowiki>http://{server_name}/servers/{server_id}/</nowiki>", "rel": "self"}]}
 +
    ]}
 +
 +
'''Unauthorized access'''
 +
:'''GET''' <nowiki>http://{api_url}/servers</nowiki>
 +
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded fake_authentication_string
 +
 +
''Response Code:''
 +
<pre>HTTP/1.1 401 Unauthorized</pre>
 +
 +
''Response Body:''
 +
    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.
 +
  
 
<!--  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 18:34, 12 April 2012

This operation will list all servers.

GET /servers?name=serverName&status=serverStatus&image=imageRef

Contents

Parameters

name - string
Optional Server name to search for.
status - string
Optional Server status to search for. Values: BUILD, ACTIVE, SUSPENDED, DELETED, UNKNOWN
image - string
Optional Absolute URL of the image to filter servers by. e.g. http://{server_name}/images/debian_lenny_template/

Result

JSON

{
   "servers":[
      {
         "id":"{server_id}",
         "links":[
            {
               "href":"http://{server_name}/servers/{server_id}/",
               "rel":"self"
            }
         ]
      },
      {
         "id":"{server_id}",
         "links":[
            {
               "href":"http://{server_name}/servers/{server_id}/",
               "rel":"self"
            }
         ]
      },
      {
         "id":"{account_server_id}",
         "links":[
            {
               "href":"http://{server_name}/servers/{server_id}/",
               "rel":"self"
            }
         ]
      }
   ]
}


id - string
Unique identifier for this server.
links - array
Hypermedia for this resource.

Response Codes

Success
HTTP/1.1 200 OK
Failure
HTTP/1.1 200 OK 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.

Examples

List servers

GET http://{api_url}/servers


Request Headers:

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

Response Code:

HTTP/1.1 200 OK

Response Body:

   {"servers":[
    {"id": "{server_id}", "links": [{"href": "http://{server_name}/servers/{server_id}/", "rel": "self"}]},
    {"id": "{server_id}", "links": [{"href": "http://{server_name}/servers/{server_id}/", "rel": "self"}]},
    ...
    {"id": "{server_id}", "links": [{"href": "http://{server_name}/servers/{server_id}/", "rel": "self"}]}
   ]}

Unauthorized access

GET http://{api_url}/servers


Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded fake_authentication_string

Response Code:

HTTP/1.1 401 Unauthorized

Response Body:

    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.


blog comments powered by Disqus


Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox