Forums

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

Bitbucket rest 1.0 : Unable to call webhooks POST api

harshainfo
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!
January 27, 2023

I am trying to use Bitbucket rest api 1.0 to create a webhook using the following POST call:

https://<bitbucket domain>/rest/api/1.0/projects/{project}/repos/{repo}/webhooks?url=https://<jenkins domain>/git/notifyCommit?url=ssh://git@<bitbucket domain>/{project}/{repo}.git

and I am getting the following error:

{
    "errors": [
        {
            "context"null,
            "message""No content to map to Object due to end of input",
            "exceptionName""java.io.EOFException"
        }
    ]
}

However the following POST call works fine and gives status 200 response:

https://<bitbucket domain>/rest/api/1.0/projects/{project}/repos/{repo}/webhooks/test?url=https://<jenkins domain>/git/notifyCommit?url=ssh://git@<bitbucket domain>/{project}/{repo}.git

Since the second call is only the test api call, it does not create the webhook, and my repo's webhooks section is empty until I can get the first api call successful.

Headers:
Content-Type: application/json,
Authorization: Bearer <Access token>

1 answer

0 votes
Ankit Srivastava
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2023

Hi @harshainfo 

Welcome to the community!

Please refer the below link:
https://docs.atlassian.com/bitbucket-server/rest/5.14.0/bitbucket-rest.html

 

Could you please cross verify the brace ({}), ---> /{repo>.git  closing brace is missing.
Please verify the quotation mark & brace

Hope this will help.

Thanks

harshainfo
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!
January 29, 2023

Thank you Ankit. Apologies, I fixed the typo. 


Yes I was using that documentation and specifically I am following the steps defined in:
https://docs.atlassian.com/bitbucket-server/rest/5.14.0/bitbucket-rest.html#idm46783598031088

Yet, I am not sure how to make the POST call to:
https://<bitbucket domain>/rest/api/1.0/projects/{project}/repos/{repo}/webhooks

to create the webhook as defined there.

Even the example request representation is empty.

Hence I would appreciate if one could reply with a working POST call to successfully create a webhook.

Thanks

Suggest an answer

Log in or Sign up to answer