| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
(webhooks)
List webhook endpoints.
Scopes: webhooks:read webhooks:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.webhooks.list_webhook_endpoints(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)
while res is not None:
# Handle items
res = res.next()| Parameter | Type | Required | Description |
|---|---|---|---|
| organization_id | OptionalNullable[models.QueryParamOrganizationID] | ➖ | Filter by organization ID. |
| page | Optional[int] | ➖ | Page number, defaults to 1. |
| limit | Optional[int] | ➖ | Size of a page, defaults to 10. Maximum is 100. |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.WebhooksListWebhookEndpointsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Create a webhook endpoint.
Scopes: webhooks:write
import polar_sdk
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.webhooks.create_webhook_endpoint(request={
"url": "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
"format_": polar_sdk.WebhookFormat.SLACK,
"events": [
polar_sdk.WebhookEventType.SUBSCRIPTION_UNCANCELED,
],
"organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
| request | models.WebhookEndpointCreate | ✔️ | The request object to use for the request. |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Get a webhook endpoint by ID.
Scopes: webhooks:read webhooks:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.webhooks.get_webhook_endpoint(id="<value>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
| id | str | ✔️ | The webhook endpoint ID. |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Update a webhook endpoint.
Scopes: webhooks:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.webhooks.update_webhook_endpoint(id="<value>", webhook_endpoint_update={
"url": "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
| id | str | ✔️ | The webhook endpoint ID. |
| webhook_endpoint_update | models.WebhookEndpointUpdate | ✔️ | N/A |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Delete a webhook endpoint.
Scopes: webhooks:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
polar.webhooks.delete_webhook_endpoint(id="<value>")
# Use the SDK ...| Parameter | Type | Required | Description |
|---|---|---|---|
| id | str | ✔️ | The webhook endpoint ID. |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Regenerate a webhook endpoint secret.
Scopes: webhooks:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.webhooks.reset_webhook_endpoint_secret(id="<value>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
| id | str | ✔️ | The webhook endpoint ID. |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
List webhook deliveries.
Deliveries are all the attempts to deliver a webhook event to an endpoint.
Scopes: webhooks:read webhooks:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.webhooks.list_webhook_deliveries(page=1, limit=10)
while res is not None:
# Handle items
res = res.next()| Parameter | Type | Required | Description |
|---|---|---|---|
| endpoint_id | OptionalNullable[models.EndpointID] | ➖ | Filter by webhook endpoint ID. |
| start_timestamp | date | ➖ | Filter deliveries after this timestamp. |
| end_timestamp | date | ➖ | Filter deliveries before this timestamp. |
| succeeded | OptionalNullable[bool] | ➖ | Filter by delivery success status. |
| query | OptionalNullable[str] | ➖ | Query to filter webhook deliveries. |
| http_code_class | OptionalNullable[models.HTTPCodeClass] | ➖ | Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx). |
| event_type | OptionalNullable[models.QueryParamEventType] | ➖ | Filter by webhook event type. |
| page | Optional[int] | ➖ | Page number, defaults to 1. |
| limit | Optional[int] | ➖ | Size of a page, defaults to 10. Maximum is 100. |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.WebhooksListWebhookDeliveriesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Schedule the re-delivery of a webhook event.
Scopes: webhooks:write
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.webhooks.redeliver_webhook_event(id="<value>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
| id | str | ✔️ | The webhook event ID. |
| retries | Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
| Back | FazBrowse Home | New Git URL |