Bitbucket Documentation

Index

Skip to end of metadata
Go to start of metadata

Repo administrators can add a POST service to a repository. bitbucket POSTs to the service URL you specify. The service receives an POST whenever user pushes to the repository. This services behaves similarly to an HTTP publish/subscribe service.

You need administrator permission for the repository, to have access to the bitbucket Admin tab. See Repository privacy, permissions, and more.

Setting Up the Service

  1. Go to the Bitbucket Admin tab.
  2. Click Services in the Additional options/settings section on the right-hand side of the screen.
  3. Select the POST service from the dropdown list in the Services Administration section.
  4. Click Add service.
    A new section appears for the POST service:

  5. Enter the URL to which Bitbucket should send its update messages.
  6. Click Save settings.

POST Data

When a user makes a push against a repository, bitbucket POSTs to the URL you provided. The body of POST request contains information about the repository where the change originated, a list of commits, and the user that made the push. 

Example

 

RELATED TOPICS

Managing bitbucket Services

Labels
  • None
  1. Apr 05, 2011

    Anonymous

    This has not worked for the last couple of weeks, having previously been not working or intermittently working over the last six months.

    This is breaking our ability to do cool things continuous-integration-wise and making it hard for me to keep my boss from insisting that we use someone else.

    1. Apr 05, 2011

      Thank you for reporting this. We've created an issue to track this and will sort this out during our upcoming iteration:

  2. Apr 28, 2011

    Is there any support for HTTP Basic authentication? I'd like to permit Bitbucket to trigger Jenkins builds, but I don't want to permit random internet people to do the same thing. Firewall rules are a poor alternative.

    1. Apr 29, 2011

      Have you tried http(s)://user:pass@host/ ?

      1. Dec 19, 2011

        I just tried 

        https://user:pass@bitbucket.org/user/myrepo.git (with my info filled in obv)

        and it tells me the repository url is incorrect or the service is not responding.

         

        Oops, I posted this in the wrong place, but it still doesn't work.

  3. Jun 21, 2011

    Anonymous

    I am looking for a possibility to parameterize the post-string with the highest branch number available in the bitbucket repository, something like http://localhost:8080/job/abc/build?branch=$

    Unknown macro: {highest-available-branch-number}

    .

    Whereby the vaule of $

    is automatically calculated.

    Any suggestions?

    Maybe I could write my own custom Bitbucket POST service as a plugin, but how can I develop and deploy it?

  4. Jun 21, 2011

    Anonymous

    I am looking for a possibility to parameterize the post-string with the highest branch number available in the bitbucket repository, something like http://localhost:8080/job/abc/build?branch=$\[highest-available-branch-number\].

    Whereby the vaule of $[highest-available-branch-number] is automatically calculated.

    Any suggestions?

    Maybe I could write my own custom Bitbucket POST service as a plugin, but how can I develop and deploy it?

  5. Jul 29, 2011

    Anonymous

    Is this broken again? It's not working for me, I know the URL works because I can test it manually and my CI machine builds, however after committing to bitbucket my build is not kicked off.

    1. Aug 01, 2011

      Verified that this is working as of this morning.

      https://bitbucket.org/site/master/issue/2900/post-service

  6. Aug 17, 2011

    Anonymous

    Is there any specific address range we can limit our firewall rules to for this service? 

  7. Mar 27, 2012

    I think this page is outdated. I have tested the POST service and my server received a POST request with the parameters below.

    {"payload"=>"{"repository": {"website": "", "fork": false, "name": "MyRepoName", "scm": "git", "absolute_url": "MyRepoUrl", "owner": "Owner", "slug": "MyRepoSlug", "is_private": true}, "commits": [{"node": "d1403d93e9fb", "files": [{"type": "added", "file": "test_hook"}], "branch": "master", "utctimestamp": "2012-03-27 15:12:59+00:00", "author": "alissonsales", "timestamp": "2012-03-27 17:12:59", "raw_node": "d1403d93e9fb4d5e2f59db154b55d2609b628f28", "parents": ["c23fcd11dcae"], "raw_author": "Alisson Sales <email@domain.com>", "message": "Test bitbucket hook\\n", "size": -1, "revision": null}], "canon_url": "https://bitbucket.org", "user": "alissonsales"}", "token"=>"MyRepoToken"}

    The request comes with only 2 parameters, payload, which appears to be a JSON, and the repository token.

    1. Mar 27, 2012

      Alisson,

      You are correct the page is outdated. I'm about to embark on a rewrite of all our REST APIs.

      Mary

  8. May 02, 2012

    Are there any plans to enable merged pull requests to trigger a POST?

  9. May 03, 2012

    Anonymous

    Can you add tags info to the POST payload?

    1. May 04, 2012

      This is an enhancement request you are making. The documentation is not a good place for those. Please go to: https://bitbucket.org/site/master/issues/new for making enhancement requests.