List flavors¶
Overview¶
Lists IDs, names, and links for available flavors.
Classification¶
- List
API Operation Object¶
- flavors
Synchronous / Asynchronous¶
- -
Request¶
HTTP Request Method¶
- GET
HTTP Request Path¶
{api_endpoint}/v2/{tenant_id}/flavors
HTTP Request Header¶
Format¶
Accept-Encoding: gzip, deflate, compress(optional)
Accept: application/json
X-Auth-Token: <token_id>
Content-Type: application/json
HTTP Request Body¶
Format¶
- none
Request Parameter¶
name | style | format | description | required/optional |
---|---|---|---|---|
tenant_id | URI | UUID | The tenant ID in a multi-tenancy cloud. | required |
minDisk | Query | int | Integer value for the minimum disk space, in GB, so that you can filter results. | optional |
minRam | Query | int | Integer value for the minimum RAM, in MB, so that you can filter results. | optional |
limit | Query | int | Requests a specified page size of returned items from the query. Returns a number of items up to the specified limit value. Use the limit parameter to make an initial limited request and use the ID of the last-seen item from the response as the marker parameter value in a subsequent limited request. | optional |
marker | Query | String | Specifies the ID of the last-seen item. Use the limit parameter to make an initial limited request and use the ID of the last-seen item from the response as the marker parameter value in a subsequent limited request. | optional |
Response¶
HTTP Response Header¶
Format¶
HTTP/1.1 <response_code> <message> (ex. 200 OK)
<response_code>: see “HTTP Responses” section
<message>: message based on the response code
- skip auto insert field such as “X-Compute-Request-Id” and “Content-Length”, “Date”
HTTP Response Body¶
Format¶
{
"flavors": [
{
"id": "<id>",
"links": [
{
"href": "<href>",
"rel": "<rel>"
},
{
"href": "<href>",
"rel": "<rel>"
}
],
"name": "<name>"
},
{
"id": "<id>",
"links": [
{
"href": "<href>",
"rel": "<rel>"
},
{
"href": "<href>",
"rel": "<rel>"
}
],
"name": "<name>"
},
{
"id": "<id>",
"links": [
{
"href": "<href>",
"rel": "<rel>"
},
{
"href": "<href>",
"rel": "<rel>"
}
],
"name": "<name>"
},
{
"id": "<id>",
"links": [
{
"href": "<href>",
"rel": "<rel>"
},
{
"href": "<href>",
"rel": "<rel>"
}
],
"name": "<name>"
},
{
"id": "<id>",
"links": [
{
"href": "<href>",
"rel": "<rel>"
},
{
"href": "<href>",
"rel": "<rel>"
}
],
"name": "<name>"
}
]
}
Response Parameter¶
item | format | description |
---|---|---|
X-Compute-Request-ID (Optional) | String | Returns a unique identifier to provide tracking for the request. The request ID that is associated with the request appears in the log lines for that request. By default, the middleware configuration ensures that the request ID appears in the log files. |
flavors | FlavorsWithOnlyIDsNamesLinks | Flavors are known combinations of memory, disk space, and number of CPUs. |
next (Optional) | anyURI | Moves to the next metadata item. |
previous (Optional) | anyURI | Moves to the previous metadata item. |
id | String | flavor id |
name | String | flavor name |
Sample API Request and Response¶
Sample API Request¶
Request URI¶
https://example.com/v2/{tenant_id}/flavors
Request Header¶
Accept-Encoding: gzip, deflate, compress (optional)
Accept: application/json
X-Auth-Token: ajk3adjiown02
Content-Type: application/json
Request Body¶
- none
Sample API Response¶
Response Header¶
HTTP/1.1 200 OK
<response_code>: see “HTTP Responses” section
<message>: message based on the response code
- skip auto insert field such as “X-Compute-Request-Id” and “Content-Length”, “Date”
Response Body¶
{
"flavors": [
{
"id": "1",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/1",
"rel": "self"
},
{
"href": "http://openstack.example.com/v2/openstack/flavors/1",
"rel": "bookmark"
}
],
"name": "m1.tiny"
},
{
"id": "2",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/2",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/2",
"rel": "bookmark"
}
],
"name": "m1.small"
},
{
"id": "3",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/3",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/3",
"rel": "bookmark"
}
],
"name": "m1.medium"
},
{
"id": "4",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/4",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/4",
"rel": "bookmark"
}
],
"name": "m1.large"
},
{
"id": "5",
"links": [
{
"href": "http://openstack.example.com/v2/openstack/flavors/5",
"rel": "self"
},
{
"href": "http://openstack.example.com/openstack/flavors/5",
"rel": "bookmark"
}
],
"name": "m1.xlarge"
}
]
}
Execution Example¶
HTTP Request¶
GET /v2/b17a6492bfa54441910e15f07c983384/flavors HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: 23624b4b115d45c8bef88037c1a6a7b2
Content-type: application/json
Accept: application/json
HTTP Response¶
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 2002
X-Compute-Request-Id: req-9b81af11-f41f-4602-8ffa-300359cb1e4b
Date: Tue, 06 Oct 2015 09:00:24 GMT
{"flavors": [{"id": "1", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/1", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/1", "rel": "bookmark"}], "name": "m1.tiny"}, {"id": "122", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/122", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/122", "rel": "bookmark"}], "name": "m1.micro2"}, {"id": "2", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/2", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/2", "rel": "bookmark"}], "name": "m1.small"}, {"id": "3", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/3", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/3", "rel": "bookmark"}], "name": "m1.medium"}, {"id": "4", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/4", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/4", "rel": "bookmark"}], "name": "m1.large"}, {"id": "42", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/42", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/42", "rel": "bookmark"}], "name": "m1.nano"}, {"id": "5", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/5", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/5", "rel": "bookmark"}], "name": "m1.xlarge"}, {"id": "82", "links": [{"href": "http://192.168.56.250:8774/v2/b17a6492bfa54441910e15f07c983384/flavors/82", "rel": "self"}, {"href": "http://192.168.56.250:8774/b17a6492bfa54441910e15f07c983384/flavors/82", "rel": "bookmark"}], "name": "m1.micro"}]}
Error Execution Example¶
HTTP Request¶
GET /v2/b17a6492fa54441910e15f07c983384/flavors HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: 23624b4b115d45c8bef88037c1a6a7b2
Content-type: application/json
Accept: application/json
HTTP Response¶
HTTP/1.1 400 Bad Request
Content-Length: 187
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-145b5363-258c-4548-a4de-011558235fb9
Date: Tue, 06 Oct 2015 09:03:03 GMT
{"badRequest": {"message": "Malformed request URL: URL's project_id 'b17a6492fa54441910e15f07c983384' doesn't match Context's project_id 'b17a6492bfa54441910e15f07c983384'", "code": 400}}