Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket repo created

李少鸿
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 19, 2024

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?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 22, 2024

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:

  1. Scroll down the page to get to the section Responses:

    https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/#api-workspaces-workspace-hooks-post-response
  2. Look for the title Webhook Subscription and then select + Show child properties right below that.
  3. In the child properties, expand the property events, and you will see a list with all available events for a workspace webhook.

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events