Create a task

To create a task, send a POST request to the /tasks resource: You can send a maximum of 100,000 requests of this kind per minute and a maximum of 2,000,000 requests per day.

Request

POST /api/v1/tasks ?
  [async_mode=<true/false>]
& [allow_defaults=<true/false>]
& [skip_invalid_items=<true/false>]
& [open_pool=<true/false>]
& [operation_id=<operation ID>]

Host: https://sandbox.toloka.yandex.com
Authorization: OAuth <OAuth token>
Content-Type: application/JSON

{task data}
Request parameters

Parameter

Overview

Data type

Required

async_mode

Mode for request processing:

  • true — Asynchronous. Creates an asynchronous operation that runs in the background. The response contains information about the operation (start and completion time, status).

  • false — Synchronous. The response contains information about the created task.

The default value is false.

Boolean

No

allow_defaults

Overlap settings:

The default value is false.

Boolean

No

skip_invalid_items

Validation parameters for JSON objects:

  • true — Create a task that passed validation.

  • false — Stop the operation and don't create a task.

The default value is false.

Boolean

No

open_pool

Open the pool immediately after creating a task, if the pool is closed. The default value is false.

Boolean

No

operation_id

Operation ID for asynchronous task loading (if async_mode=true).

We recommend sending the ID in the POST request to avoid accidental errors, such as creating the operation multiple times for the same task.

The ID should conform to the RFC4122 standard.

You can use this ID in the future to get information about the operation.

String

No

Parameter

Overview

Data type

Required

async_mode

Mode for request processing:

  • true — Asynchronous. Creates an asynchronous operation that runs in the background. The response contains information about the operation (start and completion time, status).

  • false — Synchronous. The response contains information about the created task.

The default value is false.

Boolean

No

allow_defaults

Overlap settings:

The default value is false.

Boolean

No

skip_invalid_items

Validation parameters for JSON objects:

  • true — Create a task that passed validation.

  • false — Stop the operation and don't create a task.

The default value is false.

Boolean

No

open_pool

Open the pool immediately after creating a task, if the pool is closed. The default value is false.

Boolean

No

operation_id

Operation ID for asynchronous task loading (if async_mode=true).

We recommend sending the ID in the POST request to avoid accidental errors, such as creating the operation multiple times for the same task.

The ID should conform to the RFC4122 standard.

You can use this ID in the future to get information about the operation.

String

No

Response

Depending on the async_mode value in the request, the response contains:

  • Information about the operation (async_mode=true).

  • Task data (async_mode=false).

Sample operation information:

{
  "id": "2ed92b7f-75c0-4771-ae2f-3911232d6d4e",
  "type": "TASK.BATCH_CREATE",
  "status": "RUNNING",
  "submitted": "2020-12-23T16:26:20.131",
  "started": "2020-12-23T16:26:20.185",
  "progress": 0,
  "parameters": {
      "open_pool": false,
      "allow_defaults": false,
      "skip_invalid_items": false
  }
}
Key descriptions

Key

Value

Data type

id

Operation ID.

String

type

Operation type:

  • POOL.OPEN — Opening a pool.

  • POOL.CLOSE — Closing a pool.

  • PROJECT.ARCHIVE — Archiving a project.

  • POOL.ARCHIVE — Archiving a pool.

  • SOLUTION.AGGREGATE — Aggregating responses.
  • TASK.BATCH_CREATE — Creating multiple tasks.

String

status

The status of the operation:

  • PENDING — Not started yet.

  • RUNNING — In progress.

  • SUCCESS — Completed successfully.

  • FAIL — Not completed.

String

submitted

The UTC date and time the request was sent, in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

started

The UTC date and time the operation started, in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

progress

The percentage of the operation completed.

Number

parameters

Operation parameters (depending on the operation type).

JSON

parameters.open_pool

Open the pool immediately after creating the tasks, if the pool is closed. The default value is false.

Boolean

parameters.allow_defaults

Overlap settings:

The default value is false.

Boolean

parameters.skip_invalid_items

Validation parameters for JSON objects:

  • true — Create the tasks that passed validation. Skip the rest of the tasks (errors will be listed in the response to the request).

  • false — If one or more tasks didn't pass validation, stop the operation and don't create any tasks.

The default value is false.

Boolean

Key

Value

Data type

id

Operation ID.

String

type

Operation type:

  • POOL.OPEN — Opening a pool.

  • POOL.CLOSE — Closing a pool.

  • PROJECT.ARCHIVE — Archiving a project.

  • POOL.ARCHIVE — Archiving a pool.

  • SOLUTION.AGGREGATE — Aggregating responses.
  • TASK.BATCH_CREATE — Creating multiple tasks.

String

status

The status of the operation:

  • PENDING — Not started yet.

  • RUNNING — In progress.

  • SUCCESS — Completed successfully.

  • FAIL — Not completed.

String

submitted

The UTC date and time the request was sent, in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

started

The UTC date and time the operation started, in ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss].

String

progress

The percentage of the operation completed.

Number

parameters

Operation parameters (depending on the operation type).

JSON

parameters.open_pool

Open the pool immediately after creating the tasks, if the pool is closed. The default value is false.

Boolean

parameters.allow_defaults

Overlap settings:

The default value is false.

Boolean

parameters.skip_invalid_items

Validation parameters for JSON objects:

  • true — Create the tasks that passed validation. Skip the rest of the tasks (errors will be listed in the response to the request).

  • false — If one or more tasks didn't pass validation, stop the operation and don't create any tasks.

The default value is false.

Boolean