FlavorList

(Difference between revisions)
Jump to: navigation, search
m (1 revision)
Line 1: Line 1:
This operation will list all available flavors optionally limited by the query parameters.
+
= GET /flavors?minDisk=''{diskInGB}''&minRam=''{ramInMB}'' =
 +
Lists all available flavors optionally limited by the query parameters.
 +
__TOC__
 +
== Request ==
 +
<code>GET /flavors?minDisk=''{diskInGB}''&minRam=''{ramInMB}''</code>
  
'''GET''' /flavors?''minDisk=diskInGB&minRam=ramInMB''
+
=== URI Parameters ===
 
+
== Parameters ==
+
 
; minDisk - ''int''
 
; minDisk - ''int''
 
: ''Optional'' Only flavors with a disk size greater than or equal to minDisk will be returned. Specified in GB.
 
: ''Optional'' Only flavors with a disk size greater than or equal to minDisk will be returned. Specified in GB.
Line 12: Line 14:
 
''Also see [[Pagination]]''
 
''Also see [[Pagination]]''
  
== Result ==
+
== Response ==
=== JSON ===
+
 
 +
=== Status Code ===
 +
; 200 OK
 +
: Success
 +
 
 +
; 401 Unauthorized
 +
: Failure - 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.
 +
 
 +
=== Response Body ===
 
  <nowiki>
 
  <nowiki>
 
{
 
{
  "flavors":[
+
  "flavors":[
      {
+
    {
        "id":"{flavor_id}",
+
      "id":"{flavor_id}",
        "links":[
+
      "links":[
            {
+
        {"href":"</nowiki>{{APIBaseURL}}<nowiki>/flavors/{flavor_id}/", "rel":"self"}
              "href":"http://{api_server}/flavors/{flavor_id}/",
+
      ],
              "rel":"self"
+
      "name":"{display_flavor_name}"
            }
+
    },
        ],
+
    {
        "name":"{display_flavor_name}"
+
      "id":"{flavor_id}",
      },
+
      "links":[
      {
+
        {"href":"</nowiki>{{APIBaseURL}}<nowiki>/flavors/{flavor_id}/", "rel":"self"}
        "id":"{flavor_id}",
+
      ],
        "links":[
+
      "name":"{display_flavor_name}"
            {
+
    }
              "href":"http://{api_server}/flavors/{flavor_id}/",
+
  ]
              "rel":"self"
+
            }
+
        ],
+
        "name":"{display_flavor_name}"
+
      }
+
  ]
+
 
}
 
}
 
</nowiki>
 
</nowiki>
  
 +
==== Parameters ====
 
; id - ''string''
 
; id - ''string''
 
: Unique identifier for this flavor.
 
: Unique identifier for this flavor.
Line 49: Line 54:
 
; name - ''string''
 
; name - ''string''
 
: Display name for this flavor.
 
: Display name for this flavor.
 
== 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 ==
 
== Examples ==
  
'''Successfully list available flavors'''
+
=== Successfully list available flavors ===
:'''GET''' <nowiki>http://{api_server}/flavors</nowiki>
+
'''Request'''
 +
<nowiki>
 +
GET /flavors
 +
Authorization: Basic {Base64-encoded username:password string}
 +
</nowiki>
  
''Request Headers:''
+
'''Response'''
    Content-Type:application/json
+
<nowiki>
    Charset=UTF-8
+
200 OK
    Authorization:Base64-encoded username & password string
+
  
''Response Code:''
+
{
<pre>HTTP/1.1 200 OK</pre>
+
  "flavors": [
 +
    {
 +
      "name": "Small",
 +
      "links": [
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/flavors/1/", "rel": "self"},
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/flavors/1/", "rel": "bookmark"}
 +
      ],
 +
      "id": "1"
 +
    },
 +
    {
 +
      "name": "Large",
 +
      "links": [
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/flavors/3/", "rel": "self"},
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/flavors/3/", "rel": "bookmark"}
 +
      ],
 +
      "id": "3"
 +
    }
 +
  ]
 +
}
 +
</nowiki>
  
''Response Body:''
+
=== Failure while trying to make an unauthorized request ===
 +
'''Request'''
 
  <nowiki>
 
  <nowiki>
    {
+
GET /flavors
      "flavors": [
+
Authorization: Basic {invalid authorization}
          {
+
            "name": "Small",
+
            "links": [
+
              {
+
                "href": "http://{api_server}/flavors/1/",
+
                "rel": "self"
+
              },
+
              {
+
                "href":  "http://{api_server}/flavors/1/",
+
                "rel": "bookmark"
+
              }
+
            ],
+
            "id": "1"
+
          },
+
          {
+
            "name": "Large",
+
            "links": [
+
              {
+
                  "href": "<nowiki>http://{api_server}/flavors/3/</nowiki>",
+
                  "rel": "self"
+
              },
+
              {
+
                  "href": "<nowiki>http://{api_server}/flavors/3/",
+
                  "rel": "bookmark"}
+
            ],
+
            "id": "3"
+
          }
+
      ]
+
    }
+
 
  </nowiki>
 
  </nowiki>
  
'''Failure while trying to make an unauthorized request'''
+
'''Response'''
:'''GET''' <nowiki>http://{api_server}/flavors</nowiki>
+
<nowiki>
 
+
401 Unauthorized
''Request Headers:''
+
</nowiki>
    Content-Type:application/json
+
    Charset=UTF-8
+
    Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
+
 
+
''Response Code:''
+
<pre>HTTP/1.1 401 Unauthorized</pre>
+
  
''Response Body:''
+
== See also ==
    401 Unauthorized
+
* [[FlexCloud Server|FlexCloud Server API]]
    This server could not verify that you are authorized to
+
* [[Common Features]]
    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.
+
  
 +
{{disqus}}
 
[[Category:Hostway API]]
 
[[Category:Hostway API]]
 
[[Category:FlexCloud Server API]]
 
[[Category:FlexCloud Server API]]

Revision as of 12:31, 24 May 2013

GET /flavors?minDisk={diskInGB}&minRam={ramInMB}

Lists all available flavors optionally limited by the query parameters.

Contents

Request

GET /flavors?minDisk={diskInGB}&minRam={ramInMB}

URI Parameters

minDisk - int
Optional Only flavors with a disk size greater than or equal to minDisk will be returned. Specified in GB.
minRam - int
Optional Only flavors with a memory size greater than or equal to minRam will be returned. Specified in MB.

Also see Pagination

Response

Status Code

200 OK
Success
401 Unauthorized
Failure - 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.

Response Body

{
  "flavors":[
    {
      "id":"{flavor_id}",
      "links":[
        {"href":"https://api.hostway.com/flavors/{flavor_id}/", "rel":"self"}
      ],
      "name":"{display_flavor_name}"
    },
    {
      "id":"{flavor_id}",
      "links":[
        {"href":"https://api.hostway.com/flavors/{flavor_id}/", "rel":"self"}
      ],
      "name":"{display_flavor_name}"
    }
  ]
}

Parameters

id - string
Unique identifier for this flavor.
links - array
Hypermedia for this resource.
name - string
Display name for this flavor.

Examples

Successfully list available flavors

Request

GET /flavors
Authorization: Basic {Base64-encoded username:password string}
 

Response

200 OK

{
  "flavors": [
    {
      "name": "Small", 
      "links": [
        {"href": "https://api.hostway.com/flavors/1/", "rel": "self"}, 
        {"href": "https://api.hostway.com/flavors/1/", "rel": "bookmark"}
      ], 
      "id": "1"
    },
    {
      "name": "Large", 
      "links": [
        {"href": "https://api.hostway.com/flavors/3/", "rel": "self"},
        {"href": "https://api.hostway.com/flavors/3/", "rel": "bookmark"}
      ],
      "id": "3"
    }
  ]
}
 

Failure while trying to make an unauthorized request

Request

GET /flavors
Authorization: Basic {invalid authorization}
 

Response

401 Unauthorized
 

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox