-
Notifications
You must be signed in to change notification settings - Fork 7
Improvements to webhooks endpoints #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1e0239f
Remove `api_key_value` from GET webhook body schema, that we already …
j616 ec2cf27
Re-structure webhook endpoints, factor out examples, and add an ID fi…
j616 c8b1e04
Add ADR concerning webhook improvements
j616 19b0bac
Add ADR0037 to ADR listing
j616 26f03fb
Add link to implementation of ADR0037
j616 d4f7a59
Allow creation of webhooks using existing method to reduce impact of …
j616 46a5b1e
Update api/schemas/webhook-with-id.json
j616 9e97ffa
Tweak description of webhook PUT
j616 436c6e2
Remove un-needed 204
j616 08eb9ba
Add paging to webhooks listing endpoint
j616 e1dd3d1
Add enum to webhook event type array
j616 11a61c6
Fix event type const for `flows/segments_deleted`
j616 95b175c
Fix typo
j616 a16732f
add status and error fields to webhook records
danjhd 2f614be
Add default value for webhook status
danjhd afefad6
Fix duplicate operation ID
j616 c78f41f
Update style to match that used in recent audit of documentation
j616 d425195
Update webhook status to more closely match delete requests
j616 77f528b
Make webhook `status` optional on POST to maintain backwards compatib…
j616 0cb376a
Mark ADR0037 as accepted
j616 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [ | ||
| { | ||
| "id": "e85efab4-993b-4ad6-9af3-4cd8d0d38860", | ||
| "url": "https://hook.example.com", | ||
| "api_key_name": "Authorization", | ||
| "events": [ | ||
| "flows/created", | ||
| "flows/updated" | ||
| ], | ||
| "status": "started" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "id": "e85efab4-993b-4ad6-9af3-4cd8d0d38860", | ||
| "url": "https://hook.example.com", | ||
| "api_key_name": "Authorization", | ||
| "events": [ | ||
| "flows/created", | ||
| "flows/updated" | ||
| ], | ||
| "status": "started" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "url": "https://hook.example.com", | ||
| "api_key_name": "Authorization", | ||
| "api_key_value": "Bearer 21238dksdjqwpqscj9", | ||
| "events": [ | ||
| "flows/created", | ||
| "flows/updated" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "id": "e85efab4-993b-4ad6-9af3-4cd8d0d38860", | ||
| "url": "https://hook.example.com", | ||
| "api_key_name": "Authorization", | ||
| "api_key_value": "Bearer 21238dksdjqwpqscj9", | ||
| "events": [ | ||
| "flows/created", | ||
| "flows/updated" | ||
| ], | ||
| "status": "created" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "title": "Webhook Detail", | ||
| "description": "Describes a Webhook", | ||
| "type": "object", | ||
| "allOf": [ | ||
| { | ||
| "$ref": "webhook-with-id.json" | ||
| }, | ||
| { | ||
| "type": "object", | ||
| "required": | ||
| [ | ||
| "status" | ||
| ], | ||
| "properties": { | ||
| "error": { | ||
| "description": "Provides more information for the error status, as described by the [Error](../schemas/error#top) type", | ||
| "$ref": "error.json" | ||
| }, | ||
| "status": { | ||
samdbmg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "description": "Status of the Webhook. `created` indicates the webhook has been successfully registered but is yet to begin sending events or, depending on the service implementation, the worker responsible for sending the events has yet to start. `started` indicates the webhook is active and sending events. `disabled` indicates the webhook has been disabled by a client and is not currently sending events. `error` indicates an error condition has been encountered and the webhook has been disabled by the service instance. More information about the error condition will be indicated by the service instance in the `error` parameter. Service implementations SHOULD implement appropriate retries and only enter the `error` state when absolutely necesary. A webhook in the `error` or `disabled` state may be re-enabled by a client by setting the status to `created`. A webhook in the `created` or `started` state may be disabled by a client by setting the status to `disabled`. Attempting to transition an `error` status to `disabled` SHOULD be rejected.", | ||
| "type": "string", | ||
| "enum": [ | ||
| "created", | ||
| "started", | ||
| "disabled", | ||
| "error" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't have a
read-onlyfield on the webhook, like we do on Flows i was just wondering if this 403 is needed explicitly? Since i guess this will be produced by the RBAC/ABAC/Coarse access rules? Unless i have missed something. Feels like if we are including a 403 here we should go back and add 403 to all methods?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This was added for access control use cases. We should make sure we're consistent with this.