vCloud API Programming Guide
Example 4-6. Uploading File Data
Request:
PUT http://vcloud.example.com/transfer/.../disk0.vmdk
Content-length: 1950489088
...serialized contents of file disk0.vmdk...
EOF
Response:
200 OK
To monitor the progress of an upload, a client can use an HTTP GET request specifying the VAppTemplate
URL that was returned in the upload map. The response is the same upload map. After all the files have been
uploaded, the response includes a Task that the vAppTemplate creates to monitor the events leading up to its
resolution, and an updated value for the bytesTransferred attribute of each File element, as shown in
Example
4‐7. (The complete VAppTemplate body is returned. This example omits most of it for clarity.)
Example 4-7. Monitoring the Progress of an Upload
Request:
GET http://vcloud.example.com/api/v1.0/vAppTemplate/vappTemplate-268
Response:
200 OK
<VAppTemplate name="Ubuntu Template"
...
<Files>
...
<File size="1950489088" bytesTransferred="500000000" name="disk0.vmdk">
<Link rel="upload:default" href="http://vcloud.example.com/transfer/.../disk0.vmdk"/>
</File>
</Files>
...
</VAppTemplate>
If the response to an upload progress request indicates that the upload terminated before it was complete (for
example, if repeated progress requests show the same bytesTransferred value), a client can use the size
and bytesTransferred values from the response to construct a ranged PUT of the remaining contents, as
shown in Example
N
Ranged PUT requests are typically required for very large uploads, especially when network
OTE
bandwidth or latency could cause the operation to time out.
Example 4-8. Ranged PUT to Complete a Partial Upload
Request:
PUT http://vcloud.example.com/transfer/.../disk0.vmdkk
Content-Range: bytes 500000000-1950489087/1950489088
Content-length: 1450489088
...serialized contents of specified range...
EOF
46
href="http://vcloud.example.com/api/v1.0/vAppTemplate/vappTemplate-268" status="0"
... >
4‐8.
VMware, Inc.