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.
-
Initiate the upload request
-
Upload the chunks of the file
-
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 |
---|---|---|---|
|
String |
Authorization token |
|
|
String |
Partner login email |
|
|
String |
|
|
|
String |
|
|
|
Request Payload
{
"application":"documentmanager",
"version":"OL67",
"operatingSystem":"Windows"
}
Response
Response | Details |
---|---|
Headers |
Content-Type, Content-Encoding, Location Status: Status Codes describes when each of these HTTP status codes is returned. |
Payload |
|
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 |
---|---|---|---|
|
String |
Authorization token |
|
|
String |
Partner login email |
|
|
String |
|
|
|
String |
|
|
X-Filename |
String |
Name of the image file |
|
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: Status Codes describes when each of these HTTP status codes is returned. |
Payload |
|
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 |
---|---|---|---|
|
String |
Authorization token |
|
|
String |
Partner login email |
|
|
String |
|
|
|
String |
Image file name |
|
|
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: Status Codes describes when each of these HTTP status codes is returned. |
Payload |
|
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 |
---|---|---|---|
|
String |
Authorization token |
|
|
String |
Partner login email |
|
|
String |
|
|
|
String |
|
|
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: Status Codes describes when each of these HTTP status codes is returned. |
Payload |
|