Task Object

A task represents the state of an asynchronous, usually long-running operation. Examples include, bulk migrations, transferring buyers, and more.

This object contains the following attributes:

Field Name
Data Type
Description

id

string

Represents the task ID.

The task identifier includes the identifier of the service that owns it. The format is TSK-XXXX-YYYY-YYYY-YYYY, where XXXX corresponds to part of the Service identifier SVC-XXXX.

Example: TSK-0001-1234-1234-1234

status

enum

Represents the status of the task. A new task is created in either the queued (default) or blocked status.

code

string

Represents a task code. Different task codes are responsible for different workflows, and are prefixed with the respective service namespace.

Example: platform.accounts.buyers.transfer

name

string

The name of the specific operation.

Example: Moving the buyer to a different account

queue

string

The queue name for the task execution, sourced by the task service, is prefixed with the controlling service namespace. Queues are independent in scope of execution; tasks in the queue are executed in First In, First Out order if queued.

Example: marketplace/platform/internal/buyers/commands

object

object

A reference to the business object related to the task.

Example:

description

string

A description of the task.

Example: Moving buyer BUY-1234-1234 to account ACC-1234-1234, including 20 agreements.

parent

task

A reference to the parent task, if applicable.

Example:

progress

float

The progress in percentage, ranging from 0 to 100. For tasks that have not yet started, the progress is not defined.

Example: 21.3

eta

string (ISO 8601 datetime)

The estimated completion time for the task, if applicable.

Example: 2020-12-09T16:09:53.012Z

audit

object

A reference to the auditarrow-up-right object.

parameters

object

Optional parameters that can be used to store task-specific metadata.

Example:

result

string

The URI, which reflects the results of the task execution. It could be either:

  • A task-specific result object.

  • A relative URI to the resource, for example, a standard platform object or file.

Example: /public/v1/system/tasks/TSK-1234-1234-1234/result

owner

service

The service that owns the task.

Example:

access

A list of account with access to the task and its result.

Example:

Example

{
    "id": "TSK-0001-2474-4798-1266",
    "name": "Transferring the buyer to a different account",
    "revision": 1,
    "status": "Completed",
    "code": "accounts.buyers.transfer",
    "queue": "marketplace/platform/internal/buyers/commands",
    "object": {
        "id": "BUY-1190-0394"
    },
    "description": "Transferring buyer 'BUY-1190-0394' to account 'ACC-5563-4382'",
    "progress": 100,
    "parameters": {
        "BuyerId": "BUY-1190-0394",
        "TargetAccountId": "ACC-5563-4382"
    },
    "result": "/public/v1/accounts/buyers/BUY-1190-0394",
    "owner": {
        "id": "SVC-0001",
        "name": "platform",
        "revision": 1
    }
}

Last updated

Was this helpful?