OpenStack Image Service API v1 Reference

docs.openstack.org
API Reference
February 5, 2015
OpenStack Image Service API v1 Reference
Copyright © 2010-2015 OpenStack Foundation All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
ii
API Reference
February 5, 2015
Table of Contents
1. Image Service API v1 (SUPPORTED) ............................................................................. 1
1.1. API versions ...................................................................................................... 1
1.1.1. List API versions ..................................................................................... 2
1.2. Images ............................................................................................................. 3
1.2.1. Create image ......................................................................................... 4
1.2.2. List image details ................................................................................... 5
1.2.3. Show image details and image binary .................................................... 6
1.2.4. Update image ........................................................................................ 7
1.2.5. Delete image ......................................................................................... 8
1.3. Members .......................................................................................................... 8
1.3.1. Replace member .................................................................................... 9
1.3.2. Add member ....................................................................................... 10
1.3.3. Delete image ....................................................................................... 11
1.4. Shared images ................................................................................................ 11
1.4.1. List shared images ............................................................................... 12
iii
API Reference
February 5, 2015
1. Image Service API v1 (SUPPORTED)
Load images for use at launch time by the Compute API. Also, assign metadata to images.
Some cloud implementations do not expose this API and offer pretested images only.
Cloud providers can configure property protections that prevent non-administrative users
from updating and deleting protected properties. For more information, see Image property protection in the OpenStack Cloud Administrator Guide.
Method
URI
Description
API versions
GET
Lists information about all Image Service API versions.
/
Images
POST
/v1/images
Registers a virtual machine (VM) image.
GET
/v1/images/detail{?name,
container_format,disk_format,status,size_min,size_min,changessince}
Lists details for available images.
GET
/v1/images/{image_id}
Shows the image details as headers and the image binary
in the body of the response.
PUT
/v1/images/{image_id}
Updates an image, uploads an image file, or updates
metadata for an image.
DELETE
/v1/images/{image_id}
Deletes the specified image.
Members
PUT
/v1/images/{image_id}/members
Replaces a membership list for an image.
PUT
/v1/images/{image_id}/members/{owner_id}
Adds a member to an image.
DELETE
/v1/images/{image_id}/members/{owner_id}
Removes a member from an image.
Shared images
GET
Lists the VM images shared with a specified owner. The
owner ID is the tenant ID.
/v1/shared-images/{owner}
1.1. API versions
Method
GET
URI
Description
Lists information about all Image Service API versions.
/
1
API Reference
February 5, 2015
1.1.1. List API versions
Method
GET
URI
Description
Lists information about all Image Service API versions.
/
Normal response codes: 200, 300
1.1.1.1. Request
This operation does not accept a request body.
1.1.1.2. Response
Example 1.1. List API versions: JSON response
{
"versions": [
{
"status": "CURRENT",
"id": "v2.2",
"links": [
{
"href": "http://23.253.228.211:9292/v2/",
"rel": "self"
}
]
},
{
"status": "SUPPORTED",
"id": "v2.1",
"links": [
{
"href": "http://23.253.228.211:9292/v2/",
"rel": "self"
}
]
},
{
"status": "SUPPORTED",
"id": "v2.0",
"links": [
{
"href": "http://23.253.228.211:9292/v2/",
"rel": "self"
}
]
},
{
"status": "CURRENT",
"id": "v1.1",
"links": [
{
"href": "http://23.253.228.211:9292/v1/",
"rel": "self"
}
]
2
API Reference
February 5, 2015
},
{
"status": "SUPPORTED",
"id": "v1.0",
"links": [
{
"href": "http://23.253.228.211:9292/v1/",
"rel": "self"
}
]
}
]
}
1.2. Images
Method
URI
Description
POST
/v1/images
Registers a virtual machine (VM) image.
GET
/v1/images/detail{?name,
container_format,disk_format,status,size_min,size_min,changessince}
Lists details for available images.
GET
/v1/images/{image_id}
Shows the image details as headers and the image binary
in the body of the response.
PUT
/v1/images/{image_id}
Updates an image, uploads an image file, or updates
metadata for an image.
DELETE
/v1/images/{image_id}
Deletes the specified image.
3
API Reference
February 5, 2015
1.2.1. Create image
Method
POST
URI
Description
Registers a virtual machine (VM) image.
/v1/images
Normal response codes: 202
1.2.1.1. Request
This operation does not accept a request body.
1.2.1.2. Response
This operation does not return a response body.
4
API Reference
February 5, 2015
1.2.2. List image details
Method
GET
URI
Description
/v1/images/detail{?name,
container_format,disk_format,status,size_min,size_min,changessince}
Lists details for available images.
Normal response codes: 200
1.2.2.1. Request
This table shows the query parameters for the list image details request:
Name
name
Type
String
Description
Name of the image as a string.
(Optional)
container_format
ImageSta- Value of the container format, such as ovf, bare, aki, ari, or ami.
tus
(Optional)
disk_format
UUID
Value of the disk format.
(Optional)
status
Int
(Optional)
size_min
String
Filters the list of images to those with this status. Valid values are
queued, saving, active, killed, deleted, and pending_delete.
The minimum size of the image, in bytes.
(Optional)
size_min
String
Value of the maximum size of the image in bytes.
(Optional)
changes-since
DateTime
(Optional)
Filters the list of images to those that have changed since this time
stamp value.
This operation does not accept a request body.
1.2.2.2. Response
This operation does not return a response body.
5
API Reference
February 5, 2015
1.2.3. Show image details and image binary
Method
GET
URI
Description
Shows the image details as headers and the image binary
in the body of the response.
/v1/images/{image_id}
Normal response codes: 200
1.2.3.1. Request
This table shows the URI parameters for the show image details and image binary request:
Name
{image_id}
Type
String
Description
Image ID stored through the image API. Typically a UUID.
This operation does not accept a request body.
1.2.3.2. Response
Example 1.2. Show image details and image binary: JSON response
{
"images": [
{
"uri": "http://glance.example.com/images/71c675ab-d94f-49cd-a114e12490b328d9",
"name": "Ubuntu 10.04 Plain 5GB",
"disk_format": "vhd",
"container_format": "ovf",
"size": "5368709120",
"checksum": "c2e5db72bd7fd153f53ede5da5a06de3",
"created_at": "2010-02-03 09:34:01",
"updated_at": "2010-02-03 09:34:01",
"deleted_at": "",
"status": "active",
"is_public": true,
"min_ram": 256,
"min_disk": 5,
"owner": null,
"properties": {
"distro": "Ubuntu 10.04 LTS"
}
},
{
"...": "..."
}
]
}
6
API Reference
February 5, 2015
1.2.4. Update image
Method
PUT
URI
Description
Updates an image, uploads an image file, or updates
metadata for an image.
/v1/images/{image_id}
Normal response codes: 200
1.2.4.1. Request
This table shows the URI parameters for the update image request:
Name
{image_id}
Type
String
Description
Image ID stored through the image API. Typically a UUID.
This operation does not accept a request body.
1.2.4.2. Response
This operation does not return a response body.
7
API Reference
February 5, 2015
1.2.5. Delete image
Method
DELETE
URI
Description
Deletes the specified image.
/v1/images/{image_id}
Normal response codes: 204
1.2.5.1. Request
This table shows the URI parameters for the delete image request:
Name
{image_id}
Type
String
Description
Image ID stored through the image API. Typically a UUID.
This operation does not accept a request body.
1.3. Members
Method
URI
Description
PUT
/v1/images/{image_id}/members
Replaces a membership list for an image.
PUT
/v1/images/{image_id}/members/{owner_id}
Adds a member to an image.
DELETE
/v1/images/{image_id}/members/{owner_id}
Removes a member from an image.
8
API Reference
February 5, 2015
1.3.1. Replace member
Method
PUT
URI
Description
/v1/images/{image_id}/members
Replaces a membership list for an image.
Normal response codes: 204
1.3.1.1. Request
This table shows the URI parameters for the replace member request:
Name
{image_id}
Type
String
Description
Image ID stored through the image API. Typically a UUID.
9
API Reference
February 5, 2015
1.3.2. Add member
Method
PUT
URI
Description
Adds a member to an image.
/v1/images/{image_id}/members/{owner_id}
If you omit the request body from this call, this request adds the membership to the image,
leaves the existing memberships unmodified, and sets the can_share attribute to false for
new memberships.
Normal response codes: 204
1.3.2.1. Request
This table shows the URI parameters for the add member request:
Name
Type
Description
{image_id}
String
Image ID stored through the image API. Typically a UUID.
{owner_id}
String
Owner ID, which is the tenant ID.
Example 1.3. Add member: JSON request
{
"members": [
{
"member_id":
"can_share":
},
{
"member_id":
"can_share":
}
]
"tenant1",
false
"tenant2",
false
}
10
API Reference
February 5, 2015
1.3.3. Delete image
Method
DELETE
URI
Description
Removes a member from an image.
/v1/images/{image_id}/members/{owner_id}
Normal response codes: 204
1.3.3.1. Request
This table shows the URI parameters for the delete image request:
Name
Type
Description
{image_id}
String
Image ID stored through the image API. Typically a UUID.
{owner_id}
String
Owner ID, which is the tenant ID.
This operation does not accept a request body.
1.4. Shared images
Method
GET
URI
Description
Lists the VM images shared with a specified owner. The
owner ID is the tenant ID.
/v1/shared-images/{owner}
11
API Reference
February 5, 2015
1.4.1. List shared images
Method
GET
URI
Description
Lists the VM images shared with a specified owner. The
owner ID is the tenant ID.
/v1/shared-images/{owner}
Normal response codes: 200
1.4.1.1. Request
This operation does not accept a request body.
1.4.1.2. Response
Example 1.4. List shared images: JSON response
{
"shared_images": [
{
"image_id": "71c675ab-d94f-49cd-a114-e12490b328d9",
"can_share": false
},
{
"...": "..."
}
]
}
12