Create a subscription
Creates one or more subscriptions.
Request
PUT https://toloka.yandex.com/api/v1/webhook-subscriptions
Authorization: OAuth <OAuth token>
Content-Type: application/JSON
PUT https://sandbox.toloka.yandex.com/api/v1/webhook-subscriptions
Authorization: OAuth <OAuth token>
Content-Type: application/JSON
Headers
Title | Overview |
---|---|
Authorization | A token for account authorization. Add OAuth as a prefix. |
Content-Type | Specifies the data format in the request body. |
Title | Overview |
---|---|
Authorization | A token for account authorization. Add OAuth as a prefix. |
Content-Type | Specifies the data format in the request body. |
Request body
[ { "webhook_url": "https://awesome-requester.com/toloka-webhook", "event_type": "ASSIGNMENT_CREATED", "pool_id": "121212" }, { "webhook_url": "https://awesome-requester.com/toloka-webhook", "event_type": "POOL_CLOSED", "pool_id": "121212", "secret_key": "12345" } ]
Copied to clipboard
Parameter | Overview |
---|---|
webhook_url | string | required The URL that notifications will be sent to. |
event_type | string | required Event type. Acceptable values:
|
pool_id | string | required ID of the pool that the subscription was created for. |
secret_key | string | optional A secret key with which you can check whether incoming requests were sent through the Toloka API. For more information, see Event authentication. |
Parameter | Overview |
---|---|
webhook_url | string | required The URL that notifications will be sent to. |
event_type | string | required Event type. Acceptable values:
|
pool_id | string | required ID of the pool that the subscription was created for. |
secret_key | string | optional A secret key with which you can check whether incoming requests were sent through the Toloka API. For more information, see Event authentication. |
Response
Contains information about created subscriptions in JSON format. Each subscription is assigned a unique identifier (id
) and creation date (created
).
[
{
"webhook_url": "https://awesome-requester.com/toloka-webhook",
"event_type": "ASSIGNMENT_CREATED",
"pool_id": "121212",
"id": "webhook-subscription-1",
"created": "2020-02-03T15:00:00"
}
]
{
"items": [
"0": {
"webhook_url": "https://awesome-requester.com/toloka-webhook",
"event_type": "ASSIGNMENT_CREATED",
"pool_id": "121212",
"id": "webhook-subscription-1",
"created": "2020-02-03T15:00:00"
},
"1": {
"webhook_url": "https://awesome-requester.com/toloka-webhook",
"event_type": "POOL_CLOSED",
"pool_id": "121212",
"id": "webhook-subscription-2",
"created": "2020-02-03T15:00:00"
}
],
"validation_errors": {}
}
Parameter | Overview |
---|---|
items[] | array of objects An array of objects with information about the subscriptions created. |
<n> | object Sequential number of the subscription in the creation request (starting from 0). |
webhook_url | string The URL that notifications will be sent to. |
event_type | string Event type. Acceptable values:
|
pool_id | string ID of the pool that the subscription was created for. |
id | string ID of the subscription. Generated automatically. |
created | string The date and time when the subscription was created (UTC). It uses ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss]. |
validation_errors | object Object with validation errors. |
Parameter | Overview |
---|---|
items[] | array of objects An array of objects with information about the subscriptions created. |
<n> | object Sequential number of the subscription in the creation request (starting from 0). |
webhook_url | string The URL that notifications will be sent to. |
event_type | string Event type. Acceptable values:
|
pool_id | string ID of the pool that the subscription was created for. |
id | string ID of the subscription. Generated automatically. |
created | string The date and time when the subscription was created (UTC). It uses ISO 8601 format: YYYY-MM-DDThh:mm:ss[.sss]. |
validation_errors | object Object with validation errors. |