VMware, Inc. 21
2
ThischapterpresentsasimpleexampleofastructuredRESTworkflowfordiscoveringanddeployinga
particularvApp(inthiscase,anFTPserverwithaconnectiontothepublicInternet).
Thischapterincludesthefollowingtopics:
“LoggingInandGettinganOrganizationList”onpage 21
“BrowsinganOrganization”onpage 22
“FindingavAppTemplate”onpage 23
“GettingInformationAboutavDC”onpage 24
“InstantiatingtheTemplateinthevDC”onpage 24
“DeployingandPoweringOnthevApp”onpage 26
“GettingInformationAboutthevApp”onpage 27
“DeletingthevApp”onpage 30
“LoggingOut”onpage 30
Logging In and Getting an Organization List
EveryvCloudhasaloginURLthataclientcanobtainbymakinganunauthenticatedGETrequesttothe
vCloud’sversionsURL,asshowninExample 8‐2onpage 147.BecauseallothervCloudAPIrequestsmust
beauthenticated,anyvCloudAPIworkflowhastobeginwithaloginrequestthat
suppliesusercredentialsin
theformrequiredbyBasicHTTPauthentication(MIMEBase64encodingofastringhavingtheform
user@vcloud‐organization:password).Example 2‐1showsaloginrequestandresponseforavCloudwhoselogin
URLishttp://vcloud.example.com/api/v1.0/login.
Example 2-1. Login Request and Response
Request:
POST http://vcloud.example.com/api/v1.0/login
Authorization: Basic
encoded-credentials
Response:
200 OK
Date:
request-date
x-vcloud-authorization: cn9uYmdugN8E2j96+5Lqrc3YBvFsEgDHXzyfJrJ/6bM=
Content-Type: application/vnd.vmware.vcloud.orgList+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<OrgList ... href="http://vcloud.example.com/api/v1.0/org/" ... >
<Org type="application/vnd.vmware.vcloud.org+xml" name="ExampleOrg"
href="http://vcloud.example.com/api/v1.0/org/5"/>
Hello vCloud: A Structured REST
Workflow Example
2