To programmatically access the vCloud Compute Service, you must discover the plans and instances available in Virtual Private Cloud OnDemand.
1 | POST a request that includes your user name and password in a MIME Base64 encoding: POST https://vca.vmware.com/api/iam/login The initial POST requires that you enter the Authorization header with an encoded Base64 username:password value as shown: Authorization: Basic [email protected]:password Wherein [email protected]:password is encoded. If the request is successful, the server returns HTTP response code 201 Created and a response that contains the vchs-authorization. |
2 | Issue a request to get the list of service plans for your account: GET https://vca.vmware.com/api/sc/plans In the request, include the OAuth token: Authorization: Bearer OAuth_token Include the OAuth token in all subsequent API requests as a request header. The returned response includes the list of plans for your account. Each plan consists of the following elements: |
3 | Issue a request to get a list of all the instances: GET https://vca.vmware.com/api/sc/instances The response includes your list of all instances. Each instance has the following elements: |
POST https://vca.vmware.com/api/iam/login Accept: application/json;version=5.7 Authorization: Basic cHhzdXNlcjFAdm13YXJlLmNvbTpQYXNzQDEyMw==…
HTTP/1.1 201 Created Header: vchs-authorization: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJmOTF… Body: {"serviceGroupIds":["37"]}
GET https://vca.vmware.com/api/sc/plans Accept: application/json;version=5.7 Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJmOTF…
{ { "plans": [{ "link": [], "region": "LVG", "serviceName": "com.vmware.vchs.compute", "description": "Create virtual machines, and scale as your needs change.", "planVersion": "1.0", "instanceSpec": "", "planAttributes": "attributes", "planPolicy": { "canCreateInstance": true, "canCreateBinding": true, "maxInstanceCount": 1 }, "id": "6", "name": "Virtual Private Cloud OnDemand" }] }
Request Header – Get instances
GET https://vca.vmware.com/api/sc/instances Accept: application/json;version=5.7 Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJmOTF…
{ "instances": [{ "link": [], "description": "Create virtual machines, and scale as your needs change.", "region": "LVG", "instanceVersion": "1.0", "planId": "24", "serviceGroupId": "37", "apiUrl": "https://example_host.vmware.com/api/compute/api/org/17", "dashboardUrl": "https://example_host.vmware.com/api/compute/compute/ui?orgName=42&serviceInstanceId=17", "instanceAttributes": "{\"orgName\":\"42\",\"sessionUri\":\"https://example_host.vmware.com/api/compute/api/sessions\"}", "id": "71", "name": "Virtual Private Cloud OnDemand" }] }