Task Set Task State

Task Set Task State

Sets task state and optionally sets results or fault, as appropriate for state

Required privileges: Task.Update

Request
URI
POST
https://{vcenter-host}/sdk/vim25/{release}/Task/{moId}/SetTaskState
COPY
Path Parameters
string
moId
Required

The unique identifier for the managed object to which the method attaches; the serialized managed object reference for a request has the form moType/moId, in this case Task/{moId}.

string
release
Required

The vSphere release schema. The current specification covers vSphere 8.0.3.0 APIs.


Request Body
SetTaskStateRequestType of type(s) application/json
Required

Show optional properties

{
    "state": "string"
}
{
    "state": "string",
    "result": {
        "_typeName": "string"
    },
    "fault": {
        "_typeName": "string",
        "faultCause": "MethodFault Object",
        "faultMessage": [
            {
                "_typeName": "string",
                "key": "string",
                "arg": [
                    {
                        "_typeName": "string",
                        "key": "string",
                        "value": {
                            "_typeName": "string"
                        }
                    }
                ],
                "message": "string"
            }
        ]
    }
}
state
Required

List of possible states of a task.

Possible values:

  • queued: When there are too many tasks for threads to handle.

  • running: When the busy thread is freed from its current task by finishing the task, it picks a queued task to run.

    Then the queued tasks are marked as running.

  • success: When a running task has completed.

  • error: When a running task has encountered an error.

Possible values are : queued, running, success, error,
result
Optional

The base of all data types. Not to be used directly on the wire.

fault
Optional

The base data object type for all the object model faults that an application might handle.

Authentication
This operation uses the following authentication methods.
Responses
204

No Content

Operation doesn't return any data structure

500

InvalidState: If attempting to change states after task is completed or in error, or attempting to set the result or fault incorrectly

Returns InvalidState of type(s) application/json
This response body class contains all of the following: VimFault
{
    "_typeName": "string",
    "faultCause": "MethodFault Object",
    "faultMessage": [
        {
            "_typeName": "string",
            "key": "string",
            "arg": [
                {
                    "_typeName": "string",
                    "key": "string",
                    "value": {
                        "_typeName": "string"
                    }
                }
            ],
            "message": "string"
        }
    ]
}