Flavor

(Difference between revisions)
Jump to: navigation, search
Line 5: Line 5:
 
== Parameters ==
 
== Parameters ==
 
; id
 
; id
: The unique identifier of the flavor to be retrieved. ''Note: see warnings in [[Hypermedia]]''.
+
: The unique identifier of the flavor to be retrieved. ''Note see warnings in [[Hypermedia]]''.
  
 
== Result ==
 
== Result ==
 
=== JSON ===
 
=== JSON ===
 
 
<big><source lang="javascript">
 
<big><source lang="javascript">
 
{
 
{
 
   "flavor":{
 
   "flavor":{
       "name":"Small",
+
       "name":"{flavor_name}",
 
       "links":[
 
       "links":[
 
         {
 
         {
             "href":"http://127.0.0.1:6543/flavors/2/",
+
             "href":"http://{server_name}/flavors/{flavor_id}/",
 
             "rel":"self"
 
             "rel":"self"
 
         }
 
         }
Line 23: Line 22:
 
       "ram":512,
 
       "ram":512,
 
       "disk":10,
 
       "disk":10,
       "id":"2"
+
       "id":"{flavor_id}"
 
   }
 
   }
 
}
 
}
Line 46: Line 45:
 
; vcpu - ''number''
 
; vcpu - ''number''
 
: Number of CPUs allocated with this flavor.
 
: Number of CPUs allocated with this flavor.
 +
 +
== Response Codes ==
 +
:''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.
 +
:''HTTP/1.1 403 Forbidden'' - The resource cannot be accessed by the user
 +
:''HTTP/1.1 404 Not Found''' - The requested resource does not exist
 +
 +
== Examples ==
 +
'''View flavor details'''
 +
:'''GET''' <nowiki>http://{api_url}/flavors/{flavor_id}</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:''
 +
<big><source lang="javascript">
 +
    {
 +
      "flavor":
 +
          {
 +
            "name":"Small",
 +
            "links":[
 +
                {
 +
                  "href":"http://{server_name}/flavors/1/",
 +
                  "rel":"self"
 +
                }
 +
            ],
 +
            "vcpu":"1",
 +
            "ram":512,
 +
            "disk":10,
 +
            "id":"1"
 +
          }
 +
      }
 +
</source></big>
 +
 +
 +
'''Unauthorized request'''
 +
:'''GET''' <nowiki>http://{api_url}/flavors/{flavor_id}</nowiki>
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
 +
''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.
 +
 +
 +
'''Accessing a flavor is not allowed for this user'''
 +
:'''GET''' <nowiki>http://{api_url}/flavors/{flavor_id}</nowiki>
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded username & password string
 +
 +
''Response Code:''
 +
<pre>HTTP/1.1 403 Forbidden</pre>
 +
 +
''Response Body:''
 +
    {"forbidden": {"message": "forbidden", "code": 403, "details": ""}}
 +
 +
 +
'''Accessing a flavor that does not exist'''
 +
:'''GET''' <nowiki>http://{api_url}/flavors/{fake_flavor_id}</nowiki>
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded username & password string
 +
 +
''Response Code:''
 +
<pre>HTTP/1.1 404 Not Found</pre>
 +
 +
''Response Body:''
 +
    {"itemNotFound": {"message": "Resource not found", "code": 404, "details": ""}}
 +
  
 
<!--  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:12, 12 April 2012

This operation will return size details of a single flavor.

GET /flavors/detail/id

Contents

Parameters

id
The unique identifier of the flavor to be retrieved. Note see warnings in Hypermedia.

Result

JSON

{
   "flavor":{
      "name":"{flavor_name}",
      "links":[
         {
            "href":"http://{server_name}/flavors/{flavor_id}/",
            "rel":"self"
         }
      ],
      "vcpu":"1",
      "ram":512,
      "disk":10,
      "id":"{flavor_id}"
   }
}


id - string
Unique identifier for this flavor.
links - array
Hypermedia for this resource.
name - string
Descriptive name for this flavor.
ram - number
Memory allocated with this flavor. Specified in MB.
disk - number
Disk space allocated with this flavor. Specified in GB.
vcpu - number
Number of CPUs allocated with this flavor.

Response Codes

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.
HTTP/1.1 403 Forbidden - The resource cannot be accessed by the user
HTTP/1.1 404 Not Found' - The requested resource does not exist

Examples

View flavor details

GET http://{api_url}/flavors/{flavor_id}

Request Headers:

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

Response Code:

HTTP/1.1 200 OK

Response Body:

     {
       "flavor":
          {
             "name":"Small", 
             "links":[
                {
                  "href":"http://{server_name}/flavors/1/", 
                  "rel":"self"
                }
             ], 
             "vcpu":"1", 
             "ram":512, 
             "disk":10, 
             "id":"1"
           }
      }


Unauthorized request

GET http://{api_url}/flavors/{flavor_id}

Request Headers:

   Content-Type:application/json

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.


Accessing a flavor is not allowed for this user

GET http://{api_url}/flavors/{flavor_id}

Request Headers:

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

Response Code:

HTTP/1.1 403 Forbidden

Response Body:

    {"forbidden": {"message": "forbidden", "code": 403, "details": ""}}


Accessing a flavor that does not exist

GET http://{api_url}/flavors/{fake_flavor_id}

Request Headers:

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

Response Code:

HTTP/1.1 404 Not Found

Response Body:

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


blog comments powered by Disqus


Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox