Task Manager Create Task

Task Manager Create Task

Creates a new Task, specifying the object with which the Task is associated, the type of task, and whether the task is cancelable.

Use this operation in conjunction with the ExtensionManager.

Required privileges: Task.Create

Request
URI
POST
https://{api_host}/sdk/vim25/{release}/TaskManager/{moId}/CreateTask
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 TaskManager/{moId}.

string
release
Required

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


Request Body
CreateTaskRequestType of type(s) application/json
Required
"CreateTaskRequestType Object"
obj
Required

ManagedObject with which Task will be associated

string
taskTypeId
Required

Extension registered task type identifier for type of task being created

string
initiatedBy
Optional

The name of the user on whose behalf the Extension is creating the task

boolean
cancelable
Required

True if the task should be cancelable, false otherwise

string
parentTaskKey
Optional

Key of the task that is the parent of this task

string
activationId
Optional

Activation Id is a client-provided token to link an API call with a task. When provided, the activationId is added to the TaskInfo

Authentication
This operation uses the following authentication methods.
Responses
200

TaskInfo data object describing the new task

Returns TaskInfo of type(s) application/json
"TaskInfo Object"
string
key
Required

The unique key for the task.

task
Required

The managed object that represents this task.

description
Optional

The description field of the task describes the current phase of operation of the task.

For a task that does a single monolithic activity, this will be fixed and unchanging. For tasks that have various substeps, this field will change as the task progresses from one phase to another.

string
name
Optional

The name of the operation that created the task.

This is not set for internal tasks.

string
descriptionId
Required

An identifier for this operation.

This includes publicly visible internal tasks and is a lookup in the TaskDescription methodInfo data object.

entity
Optional

Managed entity to which the operation applies.

string
entityName
Optional

The name of the managed entity, locale-specific, retained for the history collector database.

array of object
locked
Optional

If the state of the task is "running", then this property is a list of managed entities that the operation has locked, with a shared lock.

state
Required

Runtime status of the task.

boolean
cancelled
Required

Flag to indicate whether or not the client requested cancellation of the task.

boolean
cancelable
Required

Flag to indicate whether or not the cancel task operation is supported.

error
Optional

If the task state is "error", then this property contains the fault code.

result
Optional

If the task state is "success", then this property may be used to hold a return value.

integer As int32 As int32
progress
Optional

If the task state is "running", then this property contains a progress measurement, expressed as percentage completed, from 0 to 100.

If this property is not set, then the command does not report progress.

array of object
progressDetails
Optional

Since: vSphere API Release 8.0.1.0

reason
Required

Kind of entity responsible for creating this task.

string As date-time As date-time
queueTime
Required

Time stamp when the task was created.

string As date-time As date-time
startTime
Optional

Time stamp when the task started running.

string As date-time As date-time
completeTime
Optional

Time stamp when the task was completed (whether success or failure).

integer As int32 As int32
eventChainId
Required

Event chain ID that leads to the corresponding events.

string
changeTag
Optional

The user entered tag to identify the operations and their side effects

string
parentTaskKey
Optional

Tasks can be created by another task.

This shows TaskInfo.key of the task spun off this task. This is to track causality between tasks.

string
rootTaskKey
Optional

Tasks can be created by another task and such creation can go on for multiple levels.

This is the TaskInfo.key of the task that started the chain of tasks.

string
activationId
Optional

The activation Id is a client-provided token to link an API call with a task.


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/sdk/vim25/{release}/TaskManager/{moId}/CreateTask