Skip to main content

Uploading image data

PUT /v2/images/{image_id}/file

Upload a binary image file to an image record created with POST /v2/images.

Before you can store binary image data, the request must meet the following preconditions:

  • The image must exist.
  • You must set the disk_format and container_format in the image record.
  • The image status must be queued.
  • Your image storage quota must be sufficient.
  • The size of the data you upload must not exceed the limit configured for the OpenStack Image service.

Source: OpenStack Image service API v2 — Upload binary image data

Request

Headers

  • Content-Type (header, string) — Media type descriptor for the request body. When uploading raw binary image data set this to application/octet-stream (or an appropriate image media type supported by your cloud).
  • X-Image-Meta-Store (Optional, header, string) — A store identifier to upload or import image data. Include this only for clouds that support multiple backing stores. Omit to use the default store. (New in API v2.8)
  • X-Auth-Token — Your Keystone auth token.

Path parameters

NameInTypeDescription
image_idpathstringThe UUID of the image to which you're uploading data.

Example (curl)

Set the Content-Type request header to application/octet-stream and send the image as binary data.

curl -ks -X PUT \
-H 'Content-Type: application/octet-stream' \
-H 'X-Auth-Token: gAAAAA<...>' \
--data-binary @alpine.qcow2 \
https://api.vietnix.cloud:9292/v2/images/9775d86a-8bf8-4200-a4b5-d892e931e8f6/file

Response

Success

Status CodeDescription
204 - No ContentThe server accepted the data and completed the upload. After a successful upload the image status will change to active.

Error

Status CodeDescription
400 - Bad RequestSome content in the request was invalid.
401 - UnauthorizedUser must authenticate before making a request.
403 - ForbiddenPolicy does not allow current user to do this operation.
404 - Not FoundThe requested image resource could not be found.
409 - ConflictThis operation conflicted with another operation on this resource.
410 - GoneThe access request to the target resource is no longer available.
413 - Request Entity Too LargeThe upload is larger than the server is willing or able to process.
415 - Unsupported Media TypeThe request entity has a media type which the server or resource does not support.
503 - Service UnavailableService is not available (operator/service configuration issue).