Remove read-only Webhooks under a workspace
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
Bitbucket Cloud users are not able to remove a workspace webhook using the UI because the webhook is marked as Read-Only.
Diagnosis
In the Bitbucket UI, when accessing the Repository Settings of a given repository to remove a previously added workspace webhook, there's no option to remove the workspace webhook as it is marked as read-only.
Cause
Workspace webhooks are created by default as read-only. Since there's no option to create read-only webhooks through the Bitbucket UI, this suggests the read-only webhook was created by a user or third-party addon/integration through the Bitbucket API endpoint Create a webhook for a workspace.
Solution
The Bitbucket API can be used to remove a read-only workspace webhook by following the below steps :
Step 1: Get all the webhooks added to the workspace.
GET https://api.bitbucket.org/2.0/workspaces/{workspace}/hooks
Example command:
1
curl -u <bitbucket_username>:<app_password> --location --request GET 'https://api.bitbucket.org/2.0/workspaces/<workspaceid>/hooks'
This should return a paginated list of all the webhooks in the provided workspace. In the result of the API call, look for the UUID field of the webhooks you want to remove.
Step 2: Delete the Read-only webhook under a workspace
DELETE https://api.bitbucket.org/2.0/repositories/<RepoSlug>/hooks/<UID>
Example command:
1
curl -u <bitbucket_username>:<app_password> --location --request DELETE 'https://api.bitbucket.org/2.0/workspaces/{workspace}/hooks/{uid}'
where the UID path parameter should be replaced with the UID of the webhook to be removed.
Was this helpful?