Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Post Webhook REST API

Ji Yong Park February 19, 2018

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!

 

2 answers

0 votes
Anderson_Norberto_Santos December 13, 2018

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!

0 votes
rvodden February 28, 2018

  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events