EasyManua.ls Logo

VMware VCLOUD API 1.0 - API - Page 46

VMware VCLOUD API 1.0 - API
212 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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
...serializedcontentsoffiledisk0.vmdk...
EOF
Response:
200 OK
Tomonitortheprogressofanupload,aclientcanuseanHTTPGETrequestspecifyingtheVAppTemplate
URLthatwasreturnedintheuploadmap.Theresponseisthesameuploadmap.Afterallthefileshavebeen
uploaded,theresponseincludesaTaskthatthevAppTemplatecreatestomonitor
theeventsleadinguptoits
resolution,andanupdatedvalueforthebytesTransferredattributeofeachFileelement,asshownin
Example 47.(ThecompleteVAppTemplatebodyisreturned.Thisexampleomitsmostofitforclarity.)
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>
Iftheresponsetoanuploadprogressrequestindicatesthattheuploadterminatedbeforeitwascomplete(for
example,ifrepeatedprogressrequestsshowthesamebytesTransferredvalue),aclientcanusethesize
andbytesTransferredvaluesfromtheresponsetoconstructarangedPUToftheremainingcontents,as
shown
inExample 48.
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
...serializedcontentsofspecifiedrange...
EOF
N
OTERangedPUTrequestsaretypicallyrequiredforverylargeuploads,especiallywhennetwork
bandwidthorlatencycouldcausetheoperationtotimeout.

Table of Contents

Related product manuals