links リソース

お困りですか?

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

コミュニティに質問

Bitbucket Cloud v1 API は廃止予定です

Bitbucket Cloud REST API version 1 is deprecated effective 30 June 2018. All 1.0 APIs will be removed from the REST API permanently on 12 April 2019. Read the deprecation notice. Or you can jump right to the version 2.0 REST API documentation.

概要

Links connect your commit messages and code comments directly to your Jira issue tracker or Bamboo build server. You can also create custom link resources. The links resource supplies functionality for adding, updating, removing, and viewing links associated with your repositories. Links have the following fields:

フィールド 説明
id A unique id assigned by Bitbucket.
handler

A profile of representing one of the following handler types:

  • Jira
  • Bamboo
  • Cruicible
  • Jenkins
  • カスタム

The content of the handler profile depends on whether the handler is a known type or a custom type. The known types of handlers have the following fields:

フィールド 説明
url The location of the service. This can start with
display_from Include references to capture groups with the syntax \1, \2, etc.
name The handler name.
key A value identifying the project on the specified url.
display_to A value created by the Bitbucket service from the url.

A custom handler has the following fields:

フィールド 説明
display_to The display name of the service.
replacement_url Include references to capture groups with the syntax \1, \2, etc.
raw_regex Include capture groups for use in your link url.
name The handler name.
display_from The display URL.

The DVCS connector creates a custom handler.

Gets an array containing the links associated with a repository. The caller must authenticate as a user with administrative access to the repository. The caller can specify the following parameters:

パラメーター

必須かどうか

説明

accountname はい The team or individual account owning the repository.
repo_slug はい The repository identifier.
ここをクリックして展開...
[
    {
        "handler": {
            "display_to": "http://172-28-13-105.staff.sf.atlassian.com:2990/jira/browse/\\1",
            "replacement_url": "http://172-28-13-105.staff.sf.atlassian.com:2990/jira/browse/\\1",
            "raw_regex": "(?<!\\w)([A-Z|a-z]{2,}-\\d+)(?!\\w)",
            "name": "custom",
            "display_from": "Custom ((?<!\\w)([A-Z|a-z]{2,}-\\d+)(?!\\w))"
        },
        "id": 25991
    },
    {
        "handler": {
            "url": "http://172-28-13-105.staff.sf.atlassian.com:2990/jira/browse",
            "display_from": "JIRA (PROJ)",
            "name": "jira",
            "key": "PROJ",
            "display_to": "http://172-28-13-105.staff.sf.atlassian.com:2990/jira/browse"
        },
        "id": 34053
    }
]

Gets an individual link on a repository. The caller must authenticate as a user with administrative access to the repository. The caller can specify the following parameters:

パラメーター

必須かどうか

説明

accountname はい The team or individual account owning the repository.
repo_slug はい The repository identifier.
object_id はい The link id.
GET https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/links/{object_id}
ここをクリックして展開...
{
        "handler": {
            "display_to": "http://172-28-13-105.staff.sf.atlassian.com:2990/jira/browse/\\1",
            "replacement_url": "http://172-28-13-105.staff.sf.atlassian.com:2990/jira/browse/\\1",
            "raw_regex": "(?<!\\w)([A-Z|a-z]{2,}-\\d+)(?!\\w)",
            "name": "custom",
            "display_from": "Custom ((?<!\\w)([A-Z|a-z]{2,}-\\d+)(?!\\w))"
        },
       "id": 25991
}

Creates a new link on the repository. The following parameters are supported:

パラメーター 必須 説明
handler はい

Valid values for the handler parameter are:

  • jira
  • bamboo
  • crucible
  • jenkins
  • custom
accountname はい The team or individual account owning the repository.
repo_slug はい The repository identifier.
link_url はい A valid URL that starts with either http or https. This parameter describes the URL at which your application exists. This value must be unique among all the repository links.
link_key はい

A non-empty string. This parameter is the project key that you are trying to link to. For example if you are linking to Jira and your project key is MYPROJ then the value should be MYPROJ.

If you are creating a custom link, this value contains a regular expression that matches the key.

The caller must authenticate as a user with administrative access to the repository.

ここをクリックして展開...
$ curl --request POST --user mcatalbas:password 'https://bitbucket.org/!api/1.0/repositories/bitbucket/staging/links/' 
{
    "handler": {
        "url": "http://yourjira.com/",
        "display_from": "JIRA (PROJ)",
        "name": "jira",
        "key": "PROJ",
        "display_to": "http://yourjira.com/"
    },
    "id": 87
}


Update a repository link. The following parameters are supported:

パラメーター 必須かどうか 説明
link_url はい A valid URL that starts with either http or https. This parameter describes the URL at which your application exists. This value must be unique among all the repository links.
link_key はい A non-empty string. This parameter is the project key that you are trying to link to. For example if you are linking to Jira and your project key is MYPROJ then the value should be MYPROJ.
accountname はい The team or individual account owning the repository.
repo_slug はい The repository identifier.
object_id はい The component identifier.

The caller must authenticate as a user with administrative access to the repository. 

{
    "handler": {
        "url": "http://yourjira.com/",
        "display_from": "JIRA (BB)",
        "name": "jira",
        "key": "BB",
        "display_to": "http://yourjira.com/"
    },
    "id": 87
}

Deletes the repository link identified by the object_id. The caller must authenticate as a user with administrative access to the repository. The caller can specify the following parameters:

パラメーター

必須かどうか

説明

accountname はい The team or individual account owning the repository.
repo_slug はい The repository identifier.
object_id はい The component identifier.
DELETE https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/links/{object_id}

When this call succeeds it returns:

HTTP/1.1 204 NO CONTENT


最終更新日 2018 年 6 月 14 日

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

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