vCloud API Programming Guide
208 VMware, Inc.
example,ortheprescribedhierarchywithwhichelementscanbenested)representthedatastructuresof
objectsinthecloud.Aclientcan“read”anobjectbymakinganHTTPGETrequesttotheobject’sURL.Aclient
can“write”(createormodify)anobjectwithanHTTPPUTorPOST
requestthatincludesaneworchanged
XMLbodydocumentfortheobject.AndaclientcanusuallydeleteanobjectwithanHTTPDELETErequest.
Inthisdocument,wepresentexamplerequestsandresponses,andalsoprovidereferenceinformationonthe
XMLschemasthatdefinetherequestandresponsebodies.
RESTful Workflow Patterns
AllRESTfulworkflowsfallintoapatternthatincludesonlytwofundamentaloperations:
MakeanHTTPrequest(typicallyGET,PUT,POST,orDELETE).Thetargetofthisrequestiseithera
well‐knownURL(suchastherootofavCloudserviceoranorganizationhostedonsuchaservice)ora
linkobtainedfromtheresponsetoapreviousrequest.(Forexample,a
GETrequesttoanorganization
URLreturnslinkstocatalogandvDCobjectscontainedbytheorganization.)
Examinetheresponse,whichalwaysincludesanHTTPresponsecodeandoftenincludesabody(anXML
document,inthevCloudAPI).Theresponsebodymaycontainlinksorotherinformationaboutthestate
ofanobject.(Forexample,aresponsethatincludesavAppbodycontainsthedetailsofthe
vApp’scurrent
virtualhardwareconfigurations,aswellaslinksthatyoucanusetoeditthatconfiguration).Ifthe
responseisanHTTPresponsecode,itindicateswhethertherequestsucceededorfailed,andmaybe
accompaniedbyaURLthatpointstoalocationfromwhichadditionalinformationcan
beretrieved.
Thesetwooperationscanrepeat,inthisorder,foraslongasnecessary.
For More Information About REST
ForacomprehensivediscussionofRESTfromboththeclientandserverperspectives,see:
Richardson,Leonard,andSamRuby.RESTfulWebServices.NorthMankato:OʹReillyMedia,Inc.,2007.
TherearealsomanysourcesofinformationaboutRESTontheWeb,including:
http://www.infoq.com/articles/rest‐introduction
http://www.infoq.com/articles/subbu‐allamaraju‐rest
http://www.stucharlton.com/blog/archives/000141.html