Let's say we're writing an API client that receives a vSphere VM UUID and needs to deploy an existing LCE agent management service to the VM.
- To find the endpoint's resource URL, the client needs to first retrieve the endpoint collection URL:
GET /vmanage-server/rest/rest-api/
{"servers":"/vmanage-server/rest/rest-api/servers", "credentials":"/vmanage-server/rest/rest-api/credentials", "vagents":"/vmanage-server/rest/rest-api/vagents"}
- Now the client can find the resource URL for the VM, by using parameterized search by UUID:
GET /vmanage-server/rest/rest-api/servers?uuid=500611e1-9027-8a47-c7f9-71bfb58e3086
Content-Type: vnd.intigua.vmanager.Servers+json
[{"url":"/vmanage-server/rest/rest-api/servers/81","status":"OK", "connectorUrl":"/vmanage-server/rest/rest-api/servers/81/connector","vagentsUrl":"/vmanage-server/rest/rest-api/servers/81/deployments", "uuid":"500611e1-9027-8a47-c7f9-71bfb58e3086", ...}]
- Assuming the LCE managed agent version and management service name are know, the client can now deploy the management service:
POST /vmanage-server/rest/rest-api/servers/81/deployments/
{"name":"lce", "version":"3.6.2.1", "configpackage":"Default"}
202 Accepted
ETag: "12345678"
Location: /vmanage-server/rest/rest-api/tasks/activity_191
Content-Type: vnd.intigua.vmanager.Task+json
{"url":"/vmanage-server/rest/rest-api/tasks/activity_191","state":"inprogress", ...}
The management service is being deployed and its managed agent is being started.
- The client can subsequently query the task status:
GET /vmanage-server/rest/rest-api/tasks/activity_191
If-None-Match: "12345678"
304 Not Modified
And, when the task is complete:
GET /vmanage-server/rest/rest-api/tasks/activity_191
If-None-Match: "12345678"
200 OK
ETAG: "11223344"
Content-Type: vnd.intigua.vmanager.Task+json
{"state" : "completed", url:"/vmanage-server/rest/rest-api/tasks/activity_191", "resourceUrl":"/vmanage-server/rest/rest-api/servers/81/deployments/42"}
The managed agent is now running and the client now has a resource URL for the management service.
Comments
0 comments
Please sign in to leave a comment.