Upload a Compute Machine Image File

For a compute listing, we need a machine image as part of the package. This machine image can be uploaded for a given partner and then used as part of the Create Application Package API and as part of the listing.

There are two ways to upload a compute machine image file:

  • Multipart Upload: The image gets uploaded in one REST API call. This is recommended for smaller size files.

  • Chunk Upload: There are three steps to upload the image. This can be done for larger files.

    1. Initiate the upload request

    2. Upload the chunks of the file

    3. Request to merge the chunks of the file and complete the upload

Machine Images API for Multipart Upload

The Machine Image Upload Request API uploads the machine image in one step. This is recommended for smaller size files.

POST	/appstore/publisher/v1/machineimages

Request Headers

Header Name Data Type Remarks Sample Data

Authorization

String

Authorization token

Bearer access_token

X-Oracle-UserId

String

Partner login email

partneruser.email@oracle.com

Cache-Control

String

no-cache

Content-Type

String

application/json,application/xml

X-Filename

Request Payload

{  
   "application":"documentmanager",
   "version":"OL67",
   "operatingSystem":"Windows"
}

Response

Response Details

Headers

Content-Type, Content-Encoding, Location

Status: 201, 400, 401, 403, 404, 405, 500

Status Codes describes when each of these HTTP status codes is returned.

Payload

{  
   "application":"documentmanager",
   "version":"OL67",
   "operatingSystem":"Windows"
}

Uploading a Machine Image in Chunks

The image file to be uploaded is divided into chunks and then merged, in a three-step process.

Initiate Upload Request

The Machine Image Upload Request API uploads the machine image in chunks.

POST	/appstore/publisher/v1/machineimages

Request Headers

Header Name Data Type Remarks Sample Data

Authorization

String

Authorization token

Bearer access_token

X-Oracle-UserId

String

Partner login email

partneruser.email@oracle.com

Cache-Control

String

no-cache

Content-Type

String

application/json,application/xml

X-Filename

String

Name of the image file

Documentmanager.tar.gz

X-Number-Of-Chunks

Number

Total number of chunks. Final step will verify this number to the number of uploaded chunks.

3

Request Payload

{  
   "application":"documentmanager",
   "version":"V1.0",
   "operatingSystem":"windows"
}

Response

Response Details

Headers

Content-Type, Content-Encoding, Location

Status: 201, 400, 401, 403, 404, 405, 500

Status Codes describes when each of these HTTP status codes is returned.

Payload

{
"message": "OK",
"entityId": "3421939"
}

Upload Chunks of the Image File

This API uploads the different file segments of the image file. The upload of chunks can be in any sequence.

POST	/appstore/publisher/v1/machineimages/entityid /chunk

The entityid value is the entity ID from the result of the Machine Image Upload Request API call.

Request Headers

Header Name Data Type Remarks Sample Data

Authorization

String

Authorization token

Bearer access_token

X-Oracle-UserId

String

Partner login email

partneruser.email@oracle.com

Cache-Control

String

no-cache

Content-Type

String

Image file name

multipart/form-data

X-Number-Of-Chunks

Number

This is the number of the current chunk being uploaded. Chunks have to be uploaded one by one. For a given chunk, X is between 1 and the total number of chunks. The chunks can be uploaded in any order.

2

Request Payload

Filen=@<ImageFile Absolute Path>

Response

Response Details

Headers

Content-Type, Content-Encoding, Location

Status: 201, 400, 401, 403, 404, 405, 500

Status Codes describes when each of these HTTP status codes is returned.

Payload

{ 
"uploadRequestId": "3421995", 
"checksum": "9ce6e1f6b3f06c12fe688f1f7031eff1", 
"uploadedChunks": 1, 
"pendingChunks": 0 
 }

Merge the Chunks of the Image File

The Merge Machine Image Chunk API merges the chunks that were uploaded earlier into a single file, to complete the upload. The upload of chunks can be in any sequence, but the merge is done sequentially.

PATCH	/appstore/publisher/v1/machineimages/entityid 

The entityid value is the entity ID from the result of the Machine Image Upload Request API call.

Request Headers

Header Name Data Type Remarks Sample Data

Authorization

String

Authorization token

Bearer access_token

X-Oracle-UserId

String

Partner login email

partneruser.email@oracle.com

Cache-Control

String

no-cache

Content-Type

String

Multipart/form-data, application/json,application/xml

X-Filename

String

Name of the image file that is being uploaded

Request Payload

{  
   "action=upload"
}

Response

Response Details

Headers

Content-Type, Content-Encoding, Location

Status: 201, 400, 401, 403, 404, 405, 500

Status Codes describes when each of these HTTP status codes is returned.

Payload

{
"message": "OK",
"entityId": "2684317 "
}