-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1731 from gchq/feature/BAI-1510-add-a-webhook-eve…
…nt-for-updating-a-release-and-add-webhook-documentation-to Feature/bai 1510 add a webhook event for updating a release and add webhook documentation to
- Loading branch information
Showing
6 changed files
with
159 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
93 changes: 93 additions & 0 deletions
93
frontend/pages/docs/users/programmatically-using-bailo/webhooks.mdx
This file contains 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,93 @@ | ||
import DocsWrapper from 'src/docs/DocsWrapper' | ||
|
||
# Webhooks | ||
|
||
Bailo provides webhooks for programmatic, event-driven interactions with individual models for interfacing with external | ||
applications. | ||
|
||
## Events | ||
|
||
A Bailo model's webhook events are: | ||
|
||
- `createRelease` | ||
- `updateRelease` | ||
- `createReviewResponse` | ||
- `createAccessRequest` | ||
|
||
To view and configure webhooks for a given model, refer to the Webhook section of our [api docs](./open-api). | ||
|
||
## Request Format | ||
|
||
When a webhook is triggered, it will send a `POST` request to the webhook's URI. | ||
|
||
The webhook will include `"Authorization": "Bearer <token>"` in the request `headers` if the webhook has a token. | ||
|
||
The body of the webhook's request will vary depending on the type of hook. | ||
|
||
### createRelease & updateRelease | ||
|
||
```json | ||
{ | ||
"event": "{createRelease|updateRelease}", | ||
"description": "A release event happened", | ||
"modelId": "abc123", | ||
"modelCardVersion": 1, | ||
"semver": "0.0.1", | ||
"notes": "Initial release", | ||
"minor": false, | ||
"draft": false, | ||
"fileIds": ["0123456789abcdef01234567"], | ||
"images": [ | ||
{ | ||
"repository": "abc123", | ||
"name": "some-docker-image", | ||
"tag": "1.0.0" | ||
} | ||
], | ||
"deleted": false, | ||
"createdBy": "user", | ||
"createdAt": "2025-01-21T12:00:00.000Z", | ||
"updatedAt": "2025-01-21T12:00:00.000Z" | ||
} | ||
``` | ||
|
||
### createReviewResponse | ||
|
||
```json | ||
{ | ||
"event": "createReviewResponse", | ||
"description": "A review response was created", | ||
"semver": "0.0.1", | ||
"accessRequestId": "123456789abcdef012345678", | ||
"modelId": "abc123", | ||
"kind": "{release|access}" | ||
"role": "mtr", | ||
"createdAt": "2025-01-21T12:00:00.000Z", | ||
"updatedAt": "2025-01-21T12:00:00.000Z" | ||
} | ||
``` | ||
|
||
### createAccessRequest | ||
|
||
```json | ||
{ | ||
"event": "createAccessRequest", | ||
"description": "An access request was created", | ||
"id": "some-access-request-mno456", | ||
"modelId": "abc123", | ||
"schemaId": "minimal-access-request-general-v10", | ||
"metadata": { | ||
"overview": { | ||
"name": "some access request", | ||
"entities": ["user:user"], | ||
"endDate": "2025-01-21" | ||
} | ||
}, | ||
"deleted": false, | ||
"createdBy": "user", | ||
"createdAt": "2025-01-21T12:00:00.000Z", | ||
"updatedAt": "2025-01-21T12:00:00.000Z" | ||
} | ||
``` | ||
|
||
export default ({ children }) => <DocsWrapper>{children}</DocsWrapper> |