POST service management

Deprecated

Creation of new service integrations has been deprecated in favor of Bitbucket Cloud's webhooks, Connect integration framework, and email notifications.

Repository administrators can add a POST service to a repository. Bitbucket Cloud POSTs to a service URL you specify. Bitbucket supports HTTPS and basic authentication. For example, you can use a URL in the format:

https://user:password@server:port/path/

The POST request originates from the IP addresses described in our firewall information page. You may need to configure your firewall to accept connections from these IP addresses.

The service receives an POST whenever user pushes to the repository. The content header of the POST has an application/x-www-form-urlencoded type. This service behave similarly to an HTTP publish/subscribe service. The payload has payload= prepended to the actual payload. The payload is url encoded content.

Set up the POST service

You can set up the POST service manually or you can automate the creation of a service from your own application.

Manually from Repository Administration

  1. Go to the repository's  settings.
  2. Click Services in the left-hand navigation.
    The Services page appears.
  3. Select the POST service from the services dropdown.
  4. Click Add service.
    A new section appears for the POST service.
  5. Enter the URL where Bitbucket should send its update messages.

  6. Press Save.

Automatically fill in from another application

If you are integrating with Bitbucket Cloud and looking for an easy way to add the service for your users, there are two methods you can use to automate this.  You can send the user to a URL structured in the following way:

https://bitbucket.org/{username}/{repo_slug}/admin/hooks?service=POST&url={your custom url}

If you're using OAuth or passing through basic authentication, you can use the api to accomplish this as well

https://api.bitbucket.org/1.0/repositories/{username}/{repo_slug}/services/ -data "type=POST&URL=https%3A%2F%2Fwww.test.com"

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 recent commits, and the user that made the push. 

Mercurial
{
    "canon_url": "https://bitbucket.org", 
    "commits": [
        {
            "author": "marcus", 
            "branch": "featureA", 
            "files": [
                {
                    "file": "somefile.py", 
                    "type": "modified"
                }
            ], 
            "message": "Added some featureA things", 
            "node": "d14d26a93fd2", 
            "parents": [
                "1b458191f31a"
            ], 
            "raw_author": "Marcus Bertrand <marcus@somedomain.com>", 
            "raw_node": "d14d26a93fd28d3166fa81c0cd3b6f339bb95bfe", 
            "revision": 3, 
            "size": -1, 
            "timestamp": "2012-05-30 06:07:03", 
            "utctimestamp": "2012-05-30 04:07:03+00:00"
        }
    ], 
    "repository": {
        "absolute_url": "/marcus/project-x/", 
        "fork": false, 
        "is_private": true, 
        "name": "Project X", 
        "owner": "marcus", 
        "scm": "hg", 
        "slug": "project-x", 
        "website": ""
    }, 
    "user": "marcus"
}
Git
{
    "canon_url": "https://bitbucket.org", 
    "commits": [
        {
            "author": "marcus", 
            "branch": "master", 
            "files": [
                {
                    "file": "somefile.py", 
                    "type": "modified"
                }
            ], 
            "message": "Added some more things to somefile.py\n", 
            "node": "620ade18607a", 
            "parents": [
                "702c70160afc"
            ], 
            "raw_author": "Marcus Bertrand <marcus@somedomain.com>", 
            "raw_node": "620ade18607ac42d872b568bb92acaa9a28620e9", 
            "revision": null, 
            "size": -1, 
            "timestamp": "2012-05-30 05:58:56", 
            "utctimestamp": "2012-05-30 03:58:56+00:00"
        }
    ], 
    "repository": {
        "absolute_url": "/marcus/project-x/", 
        "fork": false, 
        "is_private": true, 
        "name": "Project X", 
        "owner": "marcus", 
        "scm": "git", 
        "slug": "project-x", 
        "website": "https://atlassian.com/"
    }, 
    "user": "marcus"
}

If you are having trouble with the service, see  Troubleshooting Bitbucket services.
最終更新日: 2017 年 2 月 7 日

この翻訳に満足しましたか?

はい
いいえ
この記事についてのフィードバックを送信する

お探しの情報が見つかりませんか?

コミュニティへの質問

Powered by Confluence and Scroll Viewport.