Award bonuses

To award bonuses to users, send a POST request to the /user-bonuses resource. You can send a maximum of 10,000 requests of this kind per day.

Request

POST /api/v1/user-bonuses ?
  [async_mode=<true/false>]
& [skip_invalid_items=<true/false>]
& [operation_id=<operation ID>]

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

[{bonus 1}, {bonus 2},... {bonus 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 bonuses).

  • false — Synchronous. The response contains information about bonuses awarded. Maximum of 100 bonuses per request.

The default value is false.

Boolean

No

skip_invalid_items

Validation parameters for JSON objects:

  • true — Award a bonus if the JSON object with bonus information passed validation. Otherwise, skip the bonus.

  • false — Stop the operation and don't award bonuses if at least one JSON object didn't pass validation.

The default value is false.

Boolean

No

operation_id

Operation ID. Can be used for any method of request processing.

String

No

Response

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

  • Information about the operation (async_mode=true).

  • Information about bonuses (async_mode=false).

{
  "id": "26e130ad3652443a3dc5094791e48ef9",
  "type": "USER_BONUS.BATCH_CREATE",
  "status": "SUCCESS",
  "submitted": "2015-12-13T23:32:01",
  "started": "2015-12-13T23:33:00",
  "finished": "2015-12-13T23:34:12",
  "parameters": {
    "skip_invalid_items": true
  },
  "details": {
    "total_count": 2,
    "valid_count": 2,
    "not_valid_count": 0,
    "success_count": 2,
    "failed_count": 0
  }
}

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

Parameters of the operation in the request.

JSON

details

Information about the completed operation.

JSON

details. total_count

The number of bonuses in the request.

Number

details. valid_count

The number of JSON objects with bonus information that passed validation.

Number

details. not_valid_count

The number of invalid JSON objects with bonus information.

Number

details. success_count

The number of bonuses awarded.

Number

details. failed_count

The number of bonuses that weren't issued.

Number