Create multiple tasks

To create multiple tasks, send a POST request to the /tasks resource. You can send a maximum of 100,000 requests of this kind per minute and 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.ru
Authorization: OAuth <OAuth token>
Content-Type: application/JSON

[{task 1}, {task 2},... {task n}]

Request parameters:

Parameter

Description

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, number of task suites).

  • false — Synchronous. The response contains information about the created tasks. Maximum of 5000 tasks per request.

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 the tasks that passed validation. Skip the rest of the tasks (errors will be listed in the response to the request).

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

The default value is false.

Boolean

No

open_pool

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

Boolean

No

operation_id

Operation ID for asynchronous loading of tasks (if async_mode=true is set).

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

The ID should conform to the RFC4122 standard.

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

Boolean

No

Response

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

  • Information about the operation (async_mode=true).

  • Data for the tasks (async_mode=false).

{
  "id": "26e130ad3652443a3dc5094791e48ef9",
  "type": "TASK.BATCH_CREATE",
  "status": "FAIL",
  "submitted": "2015-12-13T23:32:01",
  "started": "2015-12-13T23:33:00",
  "finished": "2015-12-13T23:34:12",
  "parameters": {
    "skip_invalid_items": false
  },
  "details": {
    "total_count": 2,
    "valid_count": 1,
    "not_valid_count": 1,
    "success_count": 0,
    "failed_count": 2
  }
}
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.

  • POOL.CLONE — Cloning a pool.

  • TASK.BATCH_CREATE — Creating multiple tasks.

  • TASK_SUITE.BATCH_CREATE — Creating multiple task suites.

  • USER_BONUS.BATCH_CREATE — Awarding a bonus to multiple users.

String

status

The status of the operation:

  • PENDING — Not started yet.

  • RUNNING — In progress.

  • SUCCESS — Completed sucessfully.

  • 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

finished

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

String

parameters.skip_invalid_items

Validation parameters for JSON objects:

  • true — Create the tasks that passed validation. Skip the rest of the tasks.

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

The default value is false.

Boolean

details. total_count

The number of tasks in the request.

Number

details. valid_count

The number of tasks that passed validation.

Number

details.not_valid_count

The number of tasks that failed validation.

Number

details. success_count

The number of tasks uploaded.

Number

details. failed_count

The number of tasks that didn't upload.

Number