...
A new API getUploadParams which takes all the parameters as registertemplate/uploadvolume APIs except for URL and returns data required for upload of volume/template along with a POST URL. To upload a volume/template, the user has to make this api call and get the POST url to which the file has to be uploaded.
- Request
- type: volume or template : required required
- params while uploading a volume
- format: the format for the volume. Possible values include QCOW2, OVA, and VHD : required
- name: the name of the volume : required
- zoneid: the ID of the zone the volume is to be hosted on : required
- account: an optional accountName. Must be used with domainId.
- checksum: the MD5 checksum value of this volume
- domainid: an optional domainId. If the account parameter is used, domainId must also be used.
- imagestoreuuid: Image store uuid. The uuid of an imagestore can be obtained by doing listImageStores api call (https://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/listImageStores.html)
- projectid: Upload volume for the project
- params while uploading a tempalte
- displaytext: the display text of the template. This is usually used for display purposes: required
- format: the format for the template. Possible values include QCOW2, RAW, and VHD : required
- hypervisor: the target hypervisor for the template : required
- name: the name of the template : required
- ostypeid: the ID of the OS Type that best represents the OS of this template : required
- zoneid: the ID of the zone the template is to be hosted on : required
- account: an optional accountName. Must be used with domainId.
- bits: 32 or 64 bits support. 64 by default
- checksum: the MD5 checksum value of this template
- details: Template details in key/value pairs.
- domainid: an optional domainId. If the account parameter is used, domainId must also be used.
- isdynamicallyscalable: true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory
- isextractable: true if the template or its derivatives are extractable; default is false
- isfeatured: true if this template is a featured template, false otherwise
- ispublic: true if the template is available to all accounts; default is true
- isrouting: true if the template type is routing i.e., if template is used to deploy router
- passwordenabled: true if the template supports the password reset feature; default is false
- projectid: Register template for the project
- requireshvm: true if this template requires HVM
- sshkeyenabled: true if the template supports the sshkey upload feature; default is false
- templatetag: the tag for this template.
...
- Request: (this is a POST request)
- payload: JSON string of parameters returned from getUploadParams API call: required
- file: the location of the template/volume to be posted as multipart/form-data: required
- signature: signature returned from getUploadParams API call: required
- expires: expires returned from getUploadParams API call: required
- Response:
- '200 OK' on successful upload
- '401 authorization error' incase the signature key validation or any other validation failed
- '500 internal server error' incase the file upload fails with clear error message
- '409 conflict' incase there is already another upload with same params in-progress/success/error
...
curl -X POST "https://ssvmpublicip/upload/DD0A9FC6-C17E-4180-963C-870B9D03A80A" -F "template=@templatelocation.tar" -F "signature=de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9" -F "payload=TKPFeuz2nHmE/kcREEu24mnj1MrLdzOeJIHXR9HLIGgk56bkRJHaD0RRL2lds1rKKhrro4/PuleEh4YhRinhxaAmPpU4e55eprG8gTCX0ItyFAtlZViVdKXMew5Dfp4Qg8W9I1/IsDJd2Kas9/ftDQLiemAlPt0uS7Ou6asOCpifnBaKvhM4UGEjHSnni1KhBzjgEyDW3Y42HKJSSv58Sgmxl9LCewBX8vtn9tXKr+j4afj7Jlh7DFhyo9HOPC5ogR4hPBKqP7xF9tHxAyq6YqfBzsng3Xwe+Pb8TU1kFHg1l2DM4tY6ooW2h8lOhWUkrJu4hOAOeTeRtCjW3H452NKoeA1M8pKWuqMo5zRMti2u2hNZs0YY2yOy8oWMMG+lG0hvIlajqEU=" -F "expires=2014-10-17T12:00:00+0530" -v
Response
200 OK
template status
...