リポジトリ自動リンク用の REST API エンドポイント
REST API を使って、外部リソースへの自動リンクを追加します。
リポジトリの自動リンクについて
ワークフローを効率化するため、REST API を使って、JIRA のイシューや Zendesk のチケットなどの外部リソースへの自動リンクを追加できます。 詳しくは、「外部リソースを参照する自動リンクの構成」をご覧ください。
これらのエンドポイントを使うには、読み取りまたは書き込みアクセス権を持つリポジトリ管理アクセス許可が GitHub Apps に必要です。
Get all autolinks of a repository
Gets all autolinks that are configured for a repository.
Information about autolinks are only available to repository administrators.
"Get all autolinks of a repository" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Administration" repository permissions (read)
 
"Get all autolinks of a repository" のパラメーター
| 名前, Type, 説明 | 
|---|
accept string Setting to   | 
| 名前, Type, 説明 | 
|---|
owner string 必須The account owner of the repository. The name is not case sensitive.  | 
repo string 必須The name of the repository without the   | 
"Get all autolinks of a repository" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
200 | OK  | 
"Get all autolinks of a repository" のコード サンプル
要求の例
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinksResponse
Status: 200[
  {
    "id": 1,
    "key_prefix": "TICKET-",
    "url_template": "https://example.com/TICKET?query=<num>",
    "is_alphanumeric": true
  }
]Create an autolink reference for a repository
Users with admin access to the repository can create an autolink.
"Create an autolink reference for a repository" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Administration" repository permissions (write)
 
"Create an autolink reference for a repository" のパラメーター
| 名前, Type, 説明 | 
|---|
accept string Setting to   | 
| 名前, Type, 説明 | 
|---|
owner string 必須The account owner of the repository. The name is not case sensitive.  | 
repo string 必須The name of the repository without the   | 
| 名前, Type, 説明 | 
|---|
key_prefix string 必須This prefix appended by certain characters will generate a link any time it is found in an issue, pull request, or commit.  | 
url_template string 必須The URL must contain   | 
is_alphanumeric boolean Whether this autolink reference matches alphanumeric characters. If true, the  Default:   | 
"Create an autolink reference for a repository" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
201 | Created  | 
422 | Validation failed, or the endpoint has been spammed.  | 
"Create an autolink reference for a repository" のコード サンプル
要求の例
curl -L \
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks \
  -d '{"key_prefix":"TICKET-","url_template":"https://example.com/TICKET?query=<num>","is_alphanumeric":true}'response
Status: 201{
  "id": 1,
  "key_prefix": "TICKET-",
  "url_template": "https://example.com/TICKET?query=<num>",
  "is_alphanumeric": true
}Get an autolink reference of a repository
This returns a single autolink reference by ID that was configured for the given repository.
Information about autolinks are only available to repository administrators.
"Get an autolink reference of a repository" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Administration" repository permissions (read)
 
"Get an autolink reference of a repository" のパラメーター
| 名前, Type, 説明 | 
|---|
accept string Setting to   | 
| 名前, Type, 説明 | 
|---|
owner string 必須The account owner of the repository. The name is not case sensitive.  | 
repo string 必須The name of the repository without the   | 
autolink_id integer 必須The unique identifier of the autolink.  | 
"Get an autolink reference of a repository" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
200 | OK  | 
404 | Resource not found  | 
"Get an autolink reference of a repository" のコード サンプル
要求の例
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_IDResponse
Status: 200{
  "id": 1,
  "key_prefix": "TICKET-",
  "url_template": "https://example.com/TICKET?query=<num>",
  "is_alphanumeric": true
}Delete an autolink reference from a repository
This deletes a single autolink reference by ID that was configured for the given repository.
Information about autolinks are only available to repository administrators.
"Delete an autolink reference from a repository" のきめ細かいアクセス トークン
このエンドポイントは、次の粒度の細かいトークンの種類で動作します:
粒度の細かいトークンには次のアクセス許可セットが設定されている必要があります:
- "Administration" repository permissions (write)
 
"Delete an autolink reference from a repository" のパラメーター
| 名前, Type, 説明 | 
|---|
accept string Setting to   | 
| 名前, Type, 説明 | 
|---|
owner string 必須The account owner of the repository. The name is not case sensitive.  | 
repo string 必須The name of the repository without the   | 
autolink_id integer 必須The unique identifier of the autolink.  | 
"Delete an autolink reference from a repository" の HTTP 応答状態コード
| 状態コード | 説明 | 
|---|---|
204 | No Content  | 
404 | Resource not found  | 
"Delete an autolink reference from a repository" のコード サンプル
要求の例
curl -L \
  -X DELETE \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_IDResponse
Status: 204