Overview
This article demonstrates how to use the JetPatch API to deploy an existing LCE agent management service to a vSphere VM using the VM's UUID.
The example shows the complete workflow from retrieving collection URLs to tracking deployment progress.
API Client Workflow
The following example describes an API client that receives a vSphere VM UUID and deploys an existing LCE agent management service to the VM.
The client performs these steps in sequence:
Step 1: Retrieve the Endpoint Collection URL
The client first retrieves the collection URL to discover available resource endpoints:
| GET | /vmanage-server/rest/rest-api/ |
Response:
|
{ "servers": "/vmanage-server/rest/rest-api/servers", "credentials": "/vmanage-server/rest/rest-api/credentials", "vagents": "/vmanage-server/rest/rest-api/vagents" } |
Step 2: Find the VM Resource URL by UUID
Using the server's collection URL, the client searches for the specific VM by its UUID:
| GET | /vmanage-server/rest/rest-api/servers?uuid=500611e1-9027-8a47-c7f9-71bfb58e3086 |
Response:
|
[{ "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", ... }] |
Step 3: Deploy the Management Service
Assuming the LCE managed agent version and management service name are known, the client deploys the management service:
| POST | /vmanage-server/rest/rest-api/servers/81/deployments/ |
Request body:
|
{ "name": "lce", "version": "3.6.2.1", "configpackage": "Default" } |
Response (202 Accepted):
|
HTTP/1.1 202 Accepted ETag: "12345678" Location: /vmanage-server/rest/rest-api/tasks/activity_191
{ "url": "/vmanage-server/rest/rest-api/tasks/activity_191", "state": "inprogress", ... } |
The management service is now being deployed, and its managed agent is being started.
Step 4: Track Deployment Progress
The client queries the task status using the Location URL returned in Step 3:
| GET | /vmanage-server/rest/rest-api/tasks/activity_191 |
While in progress (304 Not Modified):
|
HTTP/1.1 304 Not Modified If-None-Match: "12345678" |
When complete (200 OK):
|
HTTP/1.1 200 OK ETag: "11223344"
{ "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.
The resourceUrl field provides the permanent resource URL for the deployed management service.
Comments
0 comments
Please sign in to leave a comment.