toloka.client.TolokaClient.upsert_webhook_subscriptions
| Source code
upsert_webhook_subscriptions(self, subscriptions: List[WebhookSubscription])
Creates (upsert) many webhook-subscriptions.
Parameters | Type | Description |
---|---|---|
subscriptions | List[WebhookSubscription] | List of webhook-subscriptions, that will be created. |
Returns:
Result of subscriptions creation.
Contains created subscriptions in items
and problems in "validation_errors".
Return type:
Examples:
How to create several subscriptions.
created_result = toloka_client.upsert_webhook_subscriptions([ { 'webhook_url': 'https://awesome-requester.com/toloka-webhook', 'event_type': toloka.webhook_subscription.WebhookSubscription.EventType.ASSIGNMENT_CREATED, 'pool_id': '121212' }, { 'webhook_url': 'https://awesome-requester.com/toloka-webhook', 'event_type': toloka.webhook_subscription.WebhookSubscription.EventType.POOL_CLOSED, 'pool_id': '121212', }])print(len(created_result.items))