I want to create a webhook that monitors the repositories creating event of a workspace, but I only see the monitoring of push, is it natively not supported?
Hi @李少鸿 and welcome to the community!
Since you are talking about a workspace, I assume you are using Bitbucket Cloud (https://bitbucket.org/)?
If so, it is possible to monitor repo creation events, but you need to do this with a workspace webhook (instead of a repo webhook). Workspace webhooks cannot be added, edited, and deleted from the UI, but only via our API.
You can use the following API endpoint to create a workspace webhook:
On the left sidebar of this page you can find additional endpoints for updating and deleting a workspace webhook, as well as listing all workspace webhooks.
An example call with curl to create a workspace webhook that monitors repo creation events:
curl -u username:app_password --request POST \
--url 'https://api.bitbucket.org/2.0/workspaces/workspace-id/hooks' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
-d '
{
"description": "Webhook Description",
"url": "https://example.com/",
"active": true,
"events": [
"repo:created"
]
}'
In bold are the values you need to replace with your own
You can find all available events on the page I shared the following way:
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.