Hello,
I am trying to use the "Post Webhooks for Bitbucket" add-on/plugin for my project and was wondering if there is a way to configure webhooks via REST api.
Currently, I am implementing a specific service to detect repo being created and seed the configurations including the post webhook. This endpoint listed in the documentation did not work for me: http://example.com/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/webhooks.
Edit: I realized that the doc I was looking at was for the latest release of the server. I am using v4.9.1, which doesn't seem to have the endpoint. Is there no other way to make this work on this version? Also, is this the correct endpoint to achieve my goal here?
Thank you!
I'm currently using Bitbucket v4.12.1 and these endpoints works for me:
GET: /rest/webhook/1.0/projects/{projectKey}/repos/{repositorySlug}/configurations
to get existing webhook data of a particular repository. The response is similar to this:
[
{
"id": 123,
"title": "Webhook's title",
"url": "https://your.server/webhook",
"committersToIgnore": "",
"branchesToIgnore": "",
"enabled": true
}
]
PUT: /rest/webhook/1.0/projects/{projectKey}/repos/{repositorySlug}/configurations
to create a webhook. The request body should be similar to this:
{
"title": "Webhook's title",
"url": "https://your.server/webhook",
"committersToIgnore": "",
"branchesToIgnore": "",
"enabled": true
}
DELETE: /rest/webhook/1.0/projects/{projectKey}/repos/{repositorySlug}/configurations/{ID}
to remove an existing webhook.
I hope helped you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.