Upload binary image data

Overview

Uploads binary image data.

Classification

  • Upload

API Operation Object

  • file

Synchronous / Asynchronous

  • synchronous

Request

HTTP Request Method

  • PUT

HTTP Request Path

{api_endpoint}/v2/images/{image_id}/file

HTTP Request Header

Format

X-Auth-Token: <token_id>
Content-Type: application/octet-stream
  • User-Agent, Host, Accept, Content-Length, Expect: 100-continue fields are automatically added

HTTP Request Body

Format

<image_data>

Request Parameter

Request Parameters
name style format description required/optional default value action for invalid parameter response code for invalid parameter
image_id URL UUID An identifier for the image required - Terminate 400, 404
token_id Header authentication token string keystone authentication token required - Terminate 401
image_data Body application/octet-stream raw binary data that represents the actual virtual disk required - Terminate 500 (if empty)

Response

HTTP Response Header

Format

HTTP/1.1 <response_code> <message>       (ex. 204 No Content)
  • <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
204 normal end
400 Specify not uuid in the image_id
- Disk_format and container_format are not set in the specified image
401 unauthorized
403 requested by non-admin user whose project is the member but not the owner of specified private image
404 specify non-existent image_id
- specify the image_id of deleted image
- if authority of non admin, requested by user whose project is not the member and not the owner of specified private image (assuming that the image has owner)
409 Specify the image whose status is not queued
- Specified image_data which is already existing in the specified image
410 Specified image vanished during the upload
413 Specified image's file size exceeds the total capacity which user can use across all storage systems
415 Content-Type does not specify application/octet-stream in Header
500 empty body
503 Not permitted to write image on storage media

HTTP Response Body

Format

  • none

Response Parameter

Response Parameters
item format description
none - -

Sample API Request and Response

Sample API Request

Request URI

https://example.com/v2/images/{image_id}/file

Request Header

X-Auth-Token: ajk3adjiown02
Content-Type: application/octet-stream
  • User-Agent, Host, Accept, Content-Length, Expect: 100-continue fields are automatically added

Request Body

<image_data>

Sample API Response

Response Header

HTTP/1.1 204 No Content
  • <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

  • none

Execution Example

HTTP Request

PUT /v2/images/cf433676-4896-400d-8ec1-05118365d9d2/file HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.11.141:9292
Accept: */*
X-Auth-Token: 7cf85eab947a4b8dbd6efe66b031d27f
Content-Type: application/octet-stream
Content-Length: 1863

Expect: 100-continue

(raw binary image data)

HTTP Response

HTTP/1.1 100 Continue
HTTP/1.1 204 No Content
Content-Type: text/html; charset=UTF-8
Content-Length: 0
X-Openstack-Request-Id: req-69b1ba04-b9f0-479f-874c-66b54682a104
Date: Tue, 26 Aug 2014 03:45:06 GMT

Error Execution Example

HTTP Request

PUT /v2/images/0cb9328d-dd8c-41bb-b378-404b854b93b9/fil HTTP/1.1
User-Agent: curl/7.35.0
Host: 192.168.56.250:9292
Accept: */*
X-Auth-Token: ad42e90aed984598b69d3ac7ab455e63
Content-Type: application/octet-stream
Content-Length: 26

HTTP Response

HTTP/1.1 404 Not Found
Content-Length: 154
Content-Type: text/html; charset=UTF-8
X-Openstack-Request-Id: req-e0eb1c7f-e186-4810-b8f8-951b31b42489
Date: Fri, 16 Oct 2015 02:17:23 GMT

404 Not Found
The resource could not be found.