vCloud API Programming Guide
46
VMware, Inc.
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"
href="http://vcloud.example.com/api/v1.0/vAppTemplate/vappTemplate-268" status="0"
... >
...
<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 4
‐
8
.
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
N
OTE
Ranged
PUT
requests
are
typically
required
for
very
large
uploads,
especially
when
network
bandwidth
or
latency
could
cause
the
operation
to
time
out.
Summary of Contents for VCLOUD API 1.0 - TECHNICAL NOTE
Page 10: ...vCloud API Programming Guide 10 VMware Inc...
Page 20: ...vCloud API Programming Guide 20 VMware Inc...
Page 32: ...vCloud API Programming Guide 32 VMware Inc...
Page 90: ...vCloud API Programming Guide 90 VMware Inc...
Page 150: ...vCloud API Programming Guide 150 VMware Inc...
Page 170: ...vCloud API Programming Guide 170 VMware Inc...