REST API - apply-task

esx settings clusters software: apply-task

Applies the desired software document associated with the given cluster to hosts within the cluster. If commit field is set, it implies the minimum commit that the apply operation should use, however if subsequent commits have been made to the desired state document the apply operation will use the most recent desired state document. The result of this operation can be queried by calling the cis/tasks/{task-id} where the task-id is the response of this operation.

Request:

HTTP request

POST https://{server}/api/esx/settings/clusters/{cluster}/software

?action=apply
&vmw-task=true
{
    "hosts"[
        "obj-103",
        "obj-103"
    ],
    "commit""obj-103",
    "accept_eula"true
}

Path Parameters

Name Type Description
Required
cluster string Identifier of the cluster.

Body Parameters:

Name Type Description
bold = required
- apply_spec Apply specification.
-.commit string The minimum commit identifier of the desired software document to be used during the apply operation.

Optional. if unset or empty the apply operation will use the latest commit to fetch the desired state document.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.esx.settings.commit. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.esx.settings.commit.

-.hosts string[] The specific hosts within the cluster to be considered during the apply operation.

Optional. if unset or empty the apply operation will remediate all hosts within the cluster.When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: HostSystem. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: HostSystem.

-.accept_eula boolean Accept the VMware End User License Agreement (EULA) before starting the apply operation. The VMware EULA is available for download at, https://www.vmware.com/download/eula.html

Optional. if unset the apply operation could fail due to the EULA not being accepted.

Response:

HTTP Status Code: 202

Response Body Structure:

"obj-103"

Headers:

None

Type:

Name Type Description
bold = required
- string The result of the apply operation.

Errors:

HTTP Status Code Type Description
400 already_in_desired_state If the cluster is already at specified commit as described in the apply specification.
500 error If there is an unknown internal error or if the EULA has not been accepted. The accompanying error message will give more details about the failure.
400 invalid_argument If the commit field of spec specifies an invalid commit, or the hosts field of spec specifies an invalid host or a host not part of the cluster, or the cluster is not managed with a single software specification.
400 not_allowed_in_current_state If there is another operation in progress.
404 not_found If there is no cluster associated with cluster in the system or if desired software document is not found.
503 service_unavailable If the service is not available.
500 timed_out If the operation times out.
401 unauthenticated If the caller is not authenticated.