ServerList

(Difference between revisions)
Jump to: navigation, search
(Examples)
Line 1: Line 1:
This operation will list all servers.
+
This operation returns a list of all [[Server|servers]].
  
'''GET''' /servers?''name=serverName&status=serverStatus&image=imageRef''
+
='''GET''' /servers?''name=serverName&status=serverStatus&image=imageRef''=
  
 
== Parameters ==
 
== Parameters ==
Line 11: Line 11:
  
 
; image - ''string''
 
; image - ''string''
: ''Optional'' Absolute URL of the image to filter servers by. ''e.g. <nowiki>http(s)://{api_server}/images/{image_id}/</nowiki>''
+
: ''Optional'' Absolute URL of the image to filter servers by. ''e.g. http(s)://{api_server}/images/{image_id}/''
  
 
== Result ==
 
== Result ==
 
=== JSON ===
 
=== JSON ===
<big><source lang="javascript">
+
<nowiki>
 
{
 
{
 
   "servers":[
 
   "servers":[
Line 37: Line 37:
 
       }
 
       }
 
   ]
 
   ]
}
+
}</nowiki>
</source></big>
+
 
+
  
 
; id - ''string''
 
; id - ''string''
Line 50: Line 48:
 
; Success:
 
; Success:
 
:''HTTP/1.1 200 OK''
 
:''HTTP/1.1 200 OK''
 +
 
; Failure:
 
; 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.
+
:''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.
  
 
== Examples ==
 
== Examples ==
 
+
'''Successfully list servers'''
'''List servers'''
+
:'''GET''' http(s)://{api_server}/servers
:'''GET''' <nowiki>http(s)://{api_server}/servers</nowiki>
+
  
  
Line 69: Line 67:
 
''Response Body:''
 
''Response Body:''
 
  <nowiki>
 
  <nowiki>
{
+
{
 
     "servers" : [
 
     "servers" : [
 
       {
 
       {
Line 99: Line 97:
 
       }
 
       }
 
     ]
 
     ]
}
+
}</nowiki>
</nowiki>
+
'''Unauthorized access'''
+
:'''GET''' <nowiki>http://{api_server}/servers</nowiki>
+
  
 +
'''Failure while trying to make unauthorized access'''
 +
:'''GET''' <nowiki>http://{api_server}/servers</nowiki>
  
 
''Request Headers:''
 
''Request Headers:''
 
     Content-Type:application/json
 
     Content-Type:application/json
 
     Charset=UTF-8
 
     Charset=UTF-8
     Authorization:Base64-encoded fake_authentication_string
+
     Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
  
 
''Response Code:''
 
''Response Code:''

Revision as of 15:59, 4 July 2012

This operation returns a list of all servers.

Contents

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

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(s)://{api_server}/images/{image_id}/

Result

JSON

{
   "servers":[
      {
         "id":"{server_id}",
         "links":[
            {
               "href":"http://{api_server}/servers/{server_id}/",
               "rel":"self"
            }
         ]
      },
      {
         "id":"{server_id}",
         "links":[
            {
               "href":"http://{api_server}/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 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.

Examples

Successfully list servers

GET http(s)://{api_server}/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": "test_server_0001", 
          "links": [
             {
                "href": "http://{api_server}/servers/test_server_0001/", 
                "rel": "self"
             }
          ]
       },
       {
          "id": "test_server_0013", 
          "links": [
             {
                "href": "http://{api_server}/servers/test_server_0013/", 
                "rel": "self"
             }
           ]
       },
       {
          "id": "test_server_0015", 
          "links": [
             {
                "href": "http://{api_server}/servers/test_server_0015/", 
                "rel": "self"
             }
          ]
       }
    ]
}

Failure while trying to make unauthorized access

GET http://{api_server}/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