services Resource

概要

Bitbucket integrates with external services (hooks) through a set of brokers that run in response to certain events.  Brokers are Python scripts that receive information about an event and then take one or more actions. For example, there is a Bamboo broker for integrating with Bamboo.   The Bitbucket team developed many of our brokers. Third-party vendors also developed several brokers.

The Bitbucket services resource provides functionality for adding, removing, and configuring brokers on your repositories.  All the methods on this resource require the caller to authenticate.  Services have the following structure:

{
        "id": 190807,
        "service": {
            "fields": [
                {
                    "name": "Password",
                    "value": ""
                },
                {
                    "name": "Username",
                    "value": ""
                },
                {
                    "name": "Discussion URL",
                    "value": ""
                }
            ],
            "type": "Basecamp"
        }
    }

The fields in the service structure are the following:

フィールド 説明
ID A Bitbucket assigned integer representing a unique identifier for the service.
サービス A profile describing the service.
  フィールド A parameter array containing a name and value pair for each parameter associated with the service.
  タイプ One of the supported services. The type is a case-insensitive value.

The following services are supported:

名前 Description and Parameters
POST Bitbucket POSTs to the service URL you specify. The service receives an POST whenever user pushes to the repository.
URL
The URL to which Bitbucket should send its update messages.
FogBugz Bug tracking service . This service has the following parameters.
Repository ID
The ID of the FogBugz repository.
CVSSubmit URL
Enter the URL to which Bitbucket should send its update messages
Basecamp
A web-based project management application.
パスワード
Your Basecamp password.
Discussion URL
Enter the URL to which Bitbucket should send its update messages.
ユーザ名
The Basecamp username.
Lighthouse
A simple issue tracking system.
Project ID
Enter the numeric ID for your project. You can get it from your project URL at Lighthouse.
For example, let's say your Lighthouse project URL is this: 
XXXXX.lighthouseapp.com/projects/00000-yourproject/overview
In this case,  00000  would be your Project ID.
API Key
Enter the API token you have created at Lighthouse (see above).
Subdomain
The Lighthouse account name.
For example, let's say your Lighthouse project URL is this: 
XXXXX.lighthouseapp.com/projects/00000-yourproject/overview
In this case, XXXXX  would be your subdomain.
課題
Allows users to reference Bitbucket issue tracker issues from commit messages. Bitbucket adds this service automatically for new issue trackers created after August 2012. This service has no parameters.
メール
Allows Bitbucket to send an email message to a given email address, for each pushed changegroup.
メール The email address to send to.
diff
Set up Bitbucket to send an email message to a given email address when the repository is updated.
メール
The email address where Bitbucket should send the email messages.
Rietveld

 
A code review tool.
メール

The URL of your Rietveld site. The default value is: http://reitveld-bitbucket.appspot.com/

パスワード
Rietveld user password.
URL
Rietveld email address.
Superfeeder
Superfeedr a real-time cloud feed parsing service. This service takes no parameters.
Geocommit
Geocommit is a service to add geolocation to your commits.
Pivotal Tracker
An agile project management tool.
Token
Tracker uses a token mechanism to authenticate API users, and access control to projects and stories is based on the user's project memberships.To generate a token, use the "Create New Token" link on the My Profile page.
Twitter
Although you can add Twitter service via API, since it requires three-legged OAuth authentication, you must configure it via the GUI interface. For details, see Twitter service management
Secret
Secret generated by Twitter.
Token
Token generated by Twitter.
形式
The format of the Twitter update.

 

GET a list of services on a repository

Lists the services existing on a repository.

GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/services
ここをクリックして展開...
[
    {
        "id": 3,
        "service": {
            "fields": [
                {
                    "name": "Email",
                    "value": "mcatalbas@atlassian.com"
                }
            ],
            "type": "Email"
        }
    },
    {
        "id": 4,
        "service": {
            "fields": [
                {
                    "name": "URL",
                    "value": "http://example.com/post"
                }
            ],
            "type": "POST"
        }
    }
]

GET a single service attached to your repository

Returns the profile of a single service attached to your repository.  You must have the service Id to use this call.

GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/services/{id}
ここをクリックして展開...
[
    {
        "id": 4,
        "service": {
            "fields": [
                {
                    "name": "URL",
                    "value": "http://example.com/post"
                }
            ],
            "type": "POST"
        }
    }
]

 

POST a new service

Adds a service to a repository. Only the type of the service is required in the POST data. (Service type is a case-insensitive match.)  Optionally, you can provide all the service parameters.  You can update service fields later.  For example, the following shows a call to create a POST service:

curl -u tutorials:8798987 -X POST https://api.bitbucket.org/1.0/repositories/tutorials/testrepo/services/ -d "type=POST&URL=https%3A%2F%2Fbitbucket.org/post"
POST https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/services/ --data "type=value&parameter=value&..."
ここをクリックして展開...
{
    "id": 5,
    "service": {
        "fields": [
            {
                "name": "URL",
                "value": "https://bitbucket.org/post"
            }
        ],
        "type": "POST"
    }
}

 

PUT a change to a service

To update a service, issue a PUT request with the id of the repository service included in the URL.  Pass each parameter separately.  You must include all the parameters in the service.  If you omit a parameter or pass an invalid parameter, the PUT removes all the values for the service.

例:

$ curl --request PUT --user mcatalbas:password https://api.bitbucket.org/1.0/repositories/mcatalbas/test/services/5/ --data "URL=https://bitbucket.org/new_post"
PUT https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/services/{id} --data "parameter=value"  --data "parameter=value" ...
ここをクリックして展開...
{
    "id": 5,
    "service": {
        "fields": [
            {
                "name": "URL",
                "value": "https://bitbucket.org/new_post"
            }
        ],
        "type": "POST"
    }
}

 

DELETE a service

Removes a service. The caller must supply the id of the service to remove for example:

$ curl --request DELETE --user mcatalbas:password https://api.bitbucket.org/1.0/repositories/mcatalbas/test/services/5/.
最終更新日 2017 年 1 月 19 日

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

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

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

コミュニティへの質問

Powered by Confluence and Scroll Viewport.