List volumes

Overview

Lists the volumes associated with the account.

Classification

  • List

API Operation Object

  • os-volumes

Synchronous / Asynchronous

  • -

Request

HTTP Request Method

  • GET

HTTP Request Path

{api_endpoint}/v2/{tenant_id}/os-volumes

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

Request Parameters
name style format description required/optional
tenant_id URI String The unique identifier of the tenant or account. required

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"

Response Code

Response Codes
response code condition
200 normal end
400 badRequest
401 unauthorized
403 forbidden
404 itemNotFound
405 badMethod
413 overLimit
503 serviceUnavailable

HTTP Response Body

Format

{
    "volumes": [
        {
            "id": "<id>",
            "display_name": "<display_name>",
            "display_description": "<display_description>",
            "size": <size>,
            "volume_type": "<volume_type>",
            "metadata": {
                "contents": "<contents>"
            },
            "availability_zone": "<availability_zone>",
            "snapshot_id": <snapshot_id>,
            "attachments": [],
            "created_at": "<created_at>"
        },
        {
            "id": "<id>",
            "display_name": "<display_name>",
            "display_description": "<display_description>",
            "size": <size>,
            "volume_type": "<volume_type>",
            "metadata": {},
            "availability_zone": "<availability_zone>",
            "snapshot_id": <snapshot_id>,
            "attachments": [],
            "created_at": "<created_at>"
        }
    ]
}

Response Parameter

Response Parameters
item format description
id UUID The volume ID.
display_name String The volume name.
display_description String The volume description.
size String The size of the volume, in gigabytes (GB).
volume_type String The unique identifier for a volume type.
contents String One or more metadata key and value pairs to associate with the volume.
availability_zone String The availability zone.
snapshot_id String The unique identifier for a snapshot.
attachments list One or more instance attachments.
created_at time/date Date and time when the volume was created.

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/{tenant_id}/os-volumes

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

{
    "volumes": [
        {
            "id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
            "display_name": "vol-001",
            "display_description": "Another volume.",
            "size": 30,
            "volume_type": "289da7f8-6440-407c-9fb4-7db01ec49164",
            "metadata": {
                "contents": "junk"
            },
            "availability_zone": "us-east1",
            "snapshot_id": null,
            "attachments": [],
            "created_at": "2012-02-14T20:53:07Z"
        },
        {
            "id": "76b8950a-8594-4e5b-8dce-0dfa9c696358",
            "display_name": "vol-002",
            "display_description": "Yet another volume.",
            "size": 25,
            "volume_type": "96c3bda7-c82a-4f50-be73-ca7621794835",
            "metadata": {},
            "availability_zone": "us-east2",
            "snapshot_id": null,
            "attachments": [],
            "created_at": "2012-03-15T19:10:03Z"
        }
    ]
}

Execution Example

HTTP Request

GET /v2/ad355aa6ed3e4cf5ae0fa0df652bc291/os-volumes HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: ebbd28fada8b4d23be04d60b912d8144
Content-type: application/json
Accept: application/json

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 647
X-Compute-Request-Id: req-28c8d35f-84e6-42e9-830e-68b656c8e72f
Date: Thu, 15 Oct 2015 05:24:24 GMT

{"volumes": [{"status": "error", "displayDescription": null, "availabilityZone": "nova", "displayName": null, "attachments": [{}], "volumeType": "lvmdriver-1", "snapshotId": null, "metadata": {"key2": "val2", "key1": "val1"}, "id": "8cecdc1f-b724-4a78-affa-1a24dd2ecebc", "createdAt": "2015-10-15T05:18:06.000000", "size": 20}, {"status": "available", "displayDescription": null, "availabilityZone": "nova", "displayName": null, "attachments": [{}], "volumeType": "lvmdriver-1", "snapshotId": null, "metadata": {"key2": "val2", "key1": "val1"}, "id": "d03c2481-7062-48c4-b27b-3aa500f382dd", "createdAt": "2015-10-15T05:16:35.000000", "size": 20}]}

Error Execution Example

HTTP Request

GET /v2/ad355aa6ed3e4cf5ae0fa0df652bc290/os-volumes HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:8774
X-Auth-Token: ebbd28fada8b4d23be04d60b912d8144
Content-type: application/json
Accept: application/json

HTTP Response

HTTP/1.1 400 Bad Request
Content-Length: 188
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-b8bcf0c2-70b3-4463-934d-e04e9746d85d
Date: Thu, 15 Oct 2015 05:25:25 GMT

{"badRequest": {"message": "Malformed request URL: URL's project_id 'ad355aa6ed3e4cf5ae0fa0df652bc290' doesn't match Context's project_id 'ad355aa6ed3e4cf5ae0fa0df652bc291'", "code": 400}}