ServerList

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
This operation will list all [[Server|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&zone=zoneTextKey''=
  
=== Parameters ===
+
== Parameters ==
 
; name - ''string''
 
; name - ''string''
 
: ''Optional'' Server name to search for.
 
: ''Optional'' Server name to search for.
Line 13: Line 13:
 
: ''Optional'' Absolute URL of the image to filter servers by. ''e.g. http(s)://{api_server}/images/{image_id}/''
 
: ''Optional'' Absolute URL of the image to filter servers by. ''e.g. http(s)://{api_server}/images/{image_id}/''
  
=== Result ===
+
; zone - ''string''
==== JSON ====
+
: ''Optional'' Zone textkey
 +
 
 +
== Result ==
 +
=== JSON ===
 
  <nowiki>
 
  <nowiki>
 
{
 
{
Line 20: Line 23:
 
       {
 
       {
 
         "id":"{server_id}",
 
         "id":"{server_id}",
 +
        "zone": "{zone_textkey}",
 
         "links":[
 
         "links":[
 
             {
 
             {
Line 29: Line 33:
 
       {
 
       {
 
         "id":"{server_id}",
 
         "id":"{server_id}",
 +
        "zone": "{zone_textkey}",
 
         "links":[
 
         "links":[
 
             {
 
             {
Line 41: Line 46:
 
; id - ''string''
 
; id - ''string''
 
: Unique identifier for this server.
 
: Unique identifier for this server.
 +
 +
; zone
 +
: Zone text key
  
 
; links - ''array''
 
; links - ''array''
 
: [[Hypermedia]] for this resource.
 
: [[Hypermedia]] for this resource.
  
=== Response Codes ===
+
== Response Codes ==
 
; Success:
 
; Success:
 
:''HTTP/1.1 200 OK''
 
:''HTTP/1.1 200 OK''
Line 52: Line 60:
 
:''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 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'''
 
'''Successfully list servers'''
 
:'''GET''' http(s)://{api_server}/servers
 
:'''GET''' http(s)://{api_server}/servers
Line 70: Line 78:
 
     "servers" : [
 
     "servers" : [
 
       {
 
       {
           "id": "test_server_0001",  
+
           "id": "test_server_0001",
 +
          "zone": "AUS001",
 
           "links": [
 
           "links": [
 
             {
 
             {
Line 79: Line 88:
 
       },
 
       },
 
       {
 
       {
           "id": "test_server_0013",  
+
           "id": "test_server_0013",
 +
          "zone": "zone",
 
           "links": [
 
           "links": [
 
             {
 
             {
Line 88: Line 98:
 
       },
 
       },
 
       {
 
       {
           "id": "test_server_0015",  
+
           "id": "test_server_0015",
 +
          "zone": "AUS001",
 
           "links": [
 
           "links": [
 
             {
 
             {
Line 119: Line 130:
 
[[Category:Hostway API]]
 
[[Category:Hostway API]]
 
[[Category:FlexCloud Server API]]
 
[[Category:FlexCloud Server API]]
 
<!--  THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->
 
 
{{#widget:DISQUS
 
|id=hostway
 
|uniqid={{PAGENAME}}
 
|url={{fullurl:{{PAGENAME}}}}
 
}}
 
 
<!--  ########################################################################### -->
 

Revision as of 08:10, 20 May 2013

This operation returns a list of all servers.

Contents

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

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}/
zone - string
Optional Zone textkey

Result

JSON

{
   "servers":[
      {
         "id":"{server_id}",
         "zone": "{zone_textkey}",
         "links":[
            {
               "href":"http://{api_server}/servers/{server_id}/",
               "rel":"self"
            }
         ]
      },
      {
         "id":"{server_id}",
         "zone": "{zone_textkey}",
         "links":[
            {
               "href":"http://{api_server}/servers/{server_id}/",
               "rel":"self"
            }
         ]
      }
   ]
}
id - string
Unique identifier for this server.
zone
Zone text key
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",
          "zone": "AUS001",
          "links": [
             {
                "href": "http://{api_server}/servers/test_server_0001/", 
                "rel": "self"
             }
          ]
       },
       {
          "id": "test_server_0013",
          "zone": "zone",
          "links": [
             {
                "href": "http://{api_server}/servers/test_server_0013/", 
                "rel": "self"
             }
           ]
       },
       {
          "id": "test_server_0015",
          "zone": "AUS001",
          "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.
Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox