# Image Data

Uploads and downloads raw image data

## Download image data

> Downloads binary image data

```json
{"openapi":"3.0.3","info":{"title":"OpenStack Image Service API v2","version":"2.0"},"tags":[{"name":"Image Data","description":"Uploads and downloads raw image data"}],"servers":[{"url":"https://{host}/glance/v2","description":"PCD Image API v2","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"responses":{"BadRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"Forbidden":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Forbidden"},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"details":{"type":"string"}}}}}}},"paths":{"/images/{image_id}/file":{"get":{"tags":["Image Data"],"parameters":[{"name":"image_id","description":"The UUID of the image","schema":{"format":"uuid","type":"string"},"in":"path","required":true},{"name":"Range","description":"The range of image data requested","schema":{"type":"string"},"in":"header","required":false}],"responses":{"200":{"headers":{"Content-Type":{"schema":{"default":"application/octet-stream","type":"string"},"description":"The media type descriptor of the response body"},"Content-MD5":{"schema":{"type":"string"},"description":"The MD5 checksum of the body"},"Content-Length":{"schema":{"type":"string"},"description":"The length of the body in octets"}},"content":{"application/octet-stream":{"schema":{"format":"binary","type":"string"}}},"description":"Image data downloaded successfully"},"204":{"description":"No image data exists"},"206":{"headers":{"Content-Range":{"schema":{"type":"string"},"description":"The content range of image data"}},"content":{"application/octet-stream":{"schema":{"format":"binary","type":"string"}}},"description":"Partial content returned"},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"416":{"description":"Range Not Satisfiable"}},"operationId":"downloadImageData","summary":"Download image data","description":"Downloads binary image data"}}}}
```

## Upload image data

> Uploads binary image data

```json
{"openapi":"3.0.3","info":{"title":"OpenStack Image Service API v2","version":"2.0"},"tags":[{"name":"Image Data","description":"Uploads and downloads raw image data"}],"servers":[{"url":"https://{host}/glance/v2","description":"PCD Image API v2","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"responses":{"BadRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"Forbidden":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Forbidden"},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"Conflict":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"Gone":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Gone"},"PayloadTooLarge":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Payload Too Large"},"UnsupportedMediaType":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unsupported Media Type"},"ServiceUnavailable":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Service Unavailable"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"details":{"type":"string"}}}}}}},"paths":{"/images/{image_id}/file":{"put":{"requestBody":{"content":{"application/octet-stream":{"schema":{"format":"binary","type":"string"}}},"required":true},"tags":["Image Data"],"parameters":[{"name":"image_id","description":"The UUID of the image","schema":{"format":"uuid","type":"string"},"in":"path","required":true},{"name":"X-Image-Meta-Store","description":"A store identifier to upload image data","schema":{"type":"string"},"in":"header","required":false}],"responses":{"204":{"description":"Image data uploaded successfully"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"410":{"$ref":"#/components/responses/Gone"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"operationId":"uploadImageData","summary":"Upload image data","description":"Uploads binary image data"}}}}
```

## Stage image data

> Places the binary image data in a staging area for interoperable image import

```json
{"openapi":"3.0.3","info":{"title":"OpenStack Image Service API v2","version":"2.0"},"tags":[{"name":"Image Data","description":"Uploads and downloads raw image data"}],"servers":[{"url":"https://{host}/glance/v2","description":"PCD Image API v2","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"responses":{"BadRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"Forbidden":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Forbidden"},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"Conflict":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"Gone":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Gone"},"PayloadTooLarge":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Payload Too Large"},"UnsupportedMediaType":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unsupported Media Type"},"ServiceUnavailable":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Service Unavailable"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"details":{"type":"string"}}}}}}},"paths":{"/images/{image_id}/stage":{"put":{"requestBody":{"content":{"application/octet-stream":{"schema":{"format":"binary","type":"string"}}},"required":true},"tags":["Image Data"],"parameters":[{"name":"image_id","description":"The UUID of the image","schema":{"format":"uuid","type":"string"},"in":"path","required":true}],"responses":{"204":{"description":"Image data staged successfully"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"405":{"description":"Method Not Allowed"},"409":{"$ref":"#/components/responses/Conflict"},"410":{"$ref":"#/components/responses/Gone"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"operationId":"stageImageData","summary":"Stage image data","description":"Places the binary image data in a staging area for interoperable image import"}}}}
```

## Import image

> Signals the Image Service to complete the image import workflow

```json
{"openapi":"3.0.3","info":{"title":"OpenStack Image Service API v2","version":"2.0"},"tags":[{"name":"Image Data","description":"Uploads and downloads raw image data"}],"servers":[{"url":"https://{host}/glance/v2","description":"PCD Image API v2","variables":{"host":{"default":"example.platform9.com","description":"The PCD controlplane hostname"}}}],"security":[{"pcdAuth":[]}],"components":{"securitySchemes":{"pcdAuth":{"name":"X-Auth-Token","type":"apiKey","in":"header","description":"PCD Identity Service token authentication"}},"schemas":{"ImageImport":{"required":["method"],"type":"object","properties":{"method":{"required":["name"],"type":"object","properties":{"name":{"description":"Import method name","enum":["glance-direct","web-download","copy-image","glance-download"],"type":"string"},"uri":{"format":"uri","description":"URI for web-download method","type":"string"},"glance_image_id":{"format":"uuid","description":"Image ID for glance-download method","type":"string"},"glance_region":{"description":"Region for glance-download method","type":"string"},"glance_service_interface":{"description":"Service interface for glance-download method","type":"string"}}},"stores":{"description":"List of store identifiers to import to","type":"array","items":{"type":"string"}},"all_stores":{"description":"Import to all available stores","type":"boolean"},"all_stores_must_succeed":{"description":"Whether all stores must succeed for the operation to succeed","type":"boolean"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"details":{"type":"string"}}}}}},"responses":{"BadRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"Forbidden":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Forbidden"},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"Conflict":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"Gone":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Gone"},"PayloadTooLarge":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Payload Too Large"},"UnsupportedMediaType":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unsupported Media Type"},"ServiceUnavailable":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Service Unavailable"}}},"paths":{"/images/{image_id}/import":{"post":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageImport"}}},"required":true},"tags":["Image Data"],"parameters":[{"name":"image_id","description":"The UUID of the image","schema":{"format":"uuid","type":"string"},"in":"path","required":true},{"name":"X-Image-Meta-Store","description":"A store identifier to import image data","schema":{"type":"string"},"in":"header","required":false}],"responses":{"202":{"description":"Image import initiated successfully"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"405":{"description":"Method Not Allowed"},"409":{"$ref":"#/components/responses/Conflict"},"410":{"$ref":"#/components/responses/Gone"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"operationId":"importImage","summary":"Import image","description":"Signals the Image Service to complete the image import workflow"}}}}
```
