API-methods for WebHooks
Requirements
- Valid Flow API ClientId and ClientSecret
- API access to WebHookSubscription - read, write, delete
Subscribe to event
Subscribes to an event with a callback URL
POST /flow/api/WebHooks/Subscribe
Body:
- EventType: WebHookEventType
- Url: string
- This callback URL must support http POST
Response:
Update subscription
PUT /flow/api/WebHooks/Subscriptions/{id}
Body:
- EventType: WebHookEventType
- Url: string
- This callback URL must support http POST
Response:
Update subscription secret
PUT /flow/api/WebHooks/Subscriptions/{id}/UpdateSecret
No body required
Response:
Get all client subscriptions
GET /flow/api/WebHooks/Subscriptions
Response:
- List<WebHookSubscriptionModel>
Get a specific subscription
GET /flow/api/WebHooks/Subscriptions/{id}
Response:
Delete a specific subscription
DELETE /flow/api/WebHooks/Subscriptions/{id}
Models
WebHookSubscriptionModel
- EventType: WebHookEventType
- CreatedDate: DateTimeOffset
- ModifiedDate: DateTimeOffset
- Url: string
- Id: int
- Secret: string
WebHook error and retry handling
Http response codes come in different flavours, and can be distinguished by the error code numbers.
Code range | Flavour | Webhook service behaviour |
---|---|---|
0-199 | Info | Webhook request is rescheduled for retry after 1 minute |
200 - 299 | Success | Webhook request logged as a success. |
300-399 | Redirect | Webhook request logged as a success. |
400-499 | Bad request | Webhook request logged as failure, will not be retried. |
500-599 | Server error | Retry with exponential backoff until either success or failure (5 retries with +1 minute per retry). |
If the request times out (takes more than 5 seconds to get a response) it will retry with exponential backoff until either success or failure (5 retries with +1 minute per retry).