Add a POST service webhook

アプリの管理

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

Repository administrators can add a POST service to a repository. Bitbucket Data Center and Server POSTs to the service URL you specify.

次の形式の URL を使用できます。

https://server:port/path/

ユーザーがリポジトリへのプッシュを行うと、サービスは POST を受け取ります。

The content type header of the POST has an application/json type. The content is a JSON payload that represents the repository push.

POST サービスのセットアップ

You can either set up the POST service manually or you can write a service to automate this. You would write a service if you are integrating an application with Bitbucket.

リポジトリの設定のセットアップ

  1. Go to Repository Settings > Hooks
  2. Click Add hook
  3. Install the Web Post Hooks for Bitbucket Server app
  4. Go back to Repository Settings > Hooks
  5. Find Post-receive WebHooks and choose Enabled
  6. Add the URLs where Bitbucket should send update messages. You can add 1 to 5 URLs.
  7. Click Enable

データの POST

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

ペイロードの例

iridium-common および iridium-magma フォルダの 2 つのファイル (pom.xml) を変更する 1 つのコミットを含むプッシュの例です。

JSON ペイロード
{
   "repository":{
      "slug":"iridium-parent",
      "id":11,
      "name":"iridium-parent",
      "scmId":"git",
      "state":"AVAILABLE",
      "statusMessage":"Available",
      "forkable":true,
      "project":{
         "key":"IR",
         "id":21,
         "name":"Iridium",
         "public":false,
         "type":"NORMAL",
         "isPersonal":false
      },
      "public":false
   },
   "refChanges":[
      {
         "refId":"refs/heads/master",
         "fromHash":"2c847c4e9c2421d038fff26ba82bc859ae6ebe20",
         "toHash":"f259e9032cdeb1e28d073e8a79a1fd6f9587f233",
         "type":"UPDATE"
      }
   ],
   "changesets":{
      "size":1,
      "limit":100,
      "isLastPage":true,
      "values":[
         {
            "fromCommit":{
               "id":"2c847c4e9c2421d038fff26ba82bc859ae6ebe20",
               "displayId":"2c847c4"
            },
            "toCommit":{
               "id":"f259e9032cdeb1e28d073e8a79a1fd6f9587f233",
               "displayId":"f259e90",
               "author":{
                  "name":"jhocman",
                  "emailAddress":"jhocman@atlassian.com"
               },
               "authorTimestamp":1374663446000,
               "message":"Updating poms ...",
               "parents":[
                  {
                     "id":"2c847c4e9c2421d038fff26ba82bc859ae6ebe20",
                     "displayId":"2c847c4"
                  }
               ]
            },
            "changes":{
               "size":2,
               "limit":500,
               "isLastPage":true,
               "values":[
                  {
                     "contentId":"2f259b79aa7e263f5829bb6e98096e7ec976d998",
                     "path":{
                        "components":[
                           "iridium-common",
                           "pom.xml"
                        ],
                        "parent":"iridium-common",
                        "name":"pom.xml",
                        "extension":"xml",
                        "toString":"iridium-common/pom.xml"
                     },
                     "executable":false,
                     "percentUnchanged":-1,
                     "type":"MODIFY",
                     "nodeType":"FILE",
                     "srcExecutable":false,
                     "link":{
                        "url":"/projects/IR/repos/iridium-parent/commits/f259e9032cdeb1e28d073e8a79a1fd6f9587f233#iridium-common/pom.xml",
                        "rel":"self"
                     }
                  },
                  {
                     "contentId":"2f259b79aa7e263f5829bb6e98096e7ec976d998",
                     "path":{
                        "components":[
                           "iridium-magma",
                           "pom.xml"
                        ],
                        "parent":"iridium-magma",
                        "name":"pom.xml",
                        "extension":"xml",
                        "toString":"iridium-magma/pom.xml"
                     },
                     "executable":false,
                     "percentUnchanged":-1,
                     "type":"MODIFY",
                     "nodeType":"FILE",
                     "srcExecutable":false,
                     "link":{
                        "url":"/projects/IR/repos/iridium-parent/commits/f259e9032cdeb1e28d073e8a79a1fd6f9587f233#iridium-magma/pom.xml",
                        "rel":"self"
                     }
                  }
               ],
               "start":0,
               "filter":null
            },
            "link":{
               "url":"/projects/IR/repos/iridium-parent/commits/f259e9032cdeb1e28d073e8a79a1fd6f9587f233#iridium-magma/pom.xml",
               "rel":"self"
            }
         }
      ],
      "start":0,
      "filter":null
   }
}

プロパティ

Some of the system-wide properties for the Webhook Plugin can be overridden in the Bitbucket configuration file. The available properties are listed in Bitbucket Server config properties.

Last modified on Mar 16, 2022

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.