Flavor

(Difference between revisions)
Jump to: navigation, search
Line 9: Line 9:
 
== Result ==
 
== Result ==
 
=== JSON ===
 
=== JSON ===
<big><source lang="javascript">
+
<nowiki>
{
+
{
   "flavor":{
+
   "flavor":
      "name":"{display_flavor_name}",
+
      {
      "links":[
+
        "name":"{display_flavor_name}",
        {
+
        "links":[
            "href":"http://{api_server}/flavors/{flavor_id}/",
+
            {
            "rel":"self"
+
              "href":"http://{api_server}/flavors/{flavor_id}/",
        }
+
              "rel":"self"
      ],
+
            }
      "vcpu":1,
+
        ],
      "ram":512,
+
        "vcpu":"1",
      "disk":10,
+
        "ram":512,
      "id":"{flavor_id}"
+
        "disk":10,
  }
+
        "id":"{flavor_id}"
 +
      }
 
}
 
}
</source></big>
+
</nowiki>
 
+
  
 
; id - ''string''
 
; id - ''string''
Line 35: Line 35:
  
 
; name - ''string''
 
; name - ''string''
: Descriptive name for this flavor.
+
: Display name for this flavor.
  
 
; ram - ''number''
 
; ram - ''number''
Line 55: Line 55:
  
 
== Examples ==
 
== Examples ==
'''View flavor details'''
+
'''Successfully view flavor details'''
 
:'''GET''' <nowiki>http://{api_server}/flavors/1</nowiki>
 
:'''GET''' <nowiki>http://{api_server}/flavors/1</nowiki>
  
Line 67: Line 67:
  
 
''Response Body:''
 
''Response Body:''
<big><source lang="javascript">
+
<nowiki>
 
     {
 
     {
 
       "flavor":
 
       "flavor":
Line 78: Line 78:
 
                 }
 
                 }
 
             ],  
 
             ],  
             "vcpu":1,  
+
             "vcpu":"1",  
 
             "ram":512,  
 
             "ram":512,  
 
             "disk":10,  
 
             "disk":10,  
Line 84: Line 84:
 
           }
 
           }
 
       }
 
       }
</source></big>
+
</nowiki>
  
 
+
'''Failure while trying to make an unauthorized request'''
'''Unauthorized request'''
+
 
:'''GET''' <nowiki>http://{api_server}/flavors/{flavor_id}</nowiki>
 
:'''GET''' <nowiki>http://{api_server}/flavors/{flavor_id}</nowiki>
  
 
''Request Headers:''
 
''Request Headers:''
 
     Content-Type:application/json
 
     Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
  
 
''Response Code:''
 
''Response Code:''
Line 104: Line 105:
  
  
'''Accessing a flavor is not allowed for this user'''
+
'''Failure while trying to access a flavor that is not allowed for this user'''
 
:'''GET''' <nowiki>http://{api_server}/flavors/{flavor_id}</nowiki>
 
:'''GET''' <nowiki>http://{api_server}/flavors/{flavor_id}</nowiki>
  
Line 119: Line 120:
  
  
'''Accessing a flavor that does not exist'''
+
'''Failure while trying to access a flavor that does not exist'''
:'''GET''' http(s)://{api_server}/flavors/{<span style="color:red">fake_flavor_id</span>}>
+
:'''GET''' http(s)://{api_server}/flavors/{<span style="color:red">fake_flavor_id</span>}
  
 
''Request Headers:''
 
''Request Headers:''

Revision as of 14:55, 4 July 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":"{display_flavor_name}",
         "links":[
            {
               "href":"http://{api_server}/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
Display 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

Successfully view flavor details

GET http://{api_server}/flavors/1

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://{api_server}/flavors/1/", 
                  "rel":"self"
                }
             ], 
             "vcpu":"1", 
             "ram":512, 
             "disk":10, 
             "id":"1"
           }
      }

Failure while trying to make an unauthorized request

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

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.


Failure while trying to access a flavor that is not allowed for this user

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


Failure while trying to access a flavor that does not exist

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