REST API ドキュメントの一部は最近移動されました。 探しているものが見つからない場合は、新しい Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks REST API ページを試してみてください。
リポジトリの自動リンク
REST API を使って、外部リソースへの自動リンクを追加します。
リポジトリの自動リンクについて
ワークフローを効率化するため、REST API を使って、JIRA のイシューや Zendesk のチケットなどの外部リソースへの自動リンクを追加できます。 詳しくは、「外部リソースを参照する自動リンクの構成」を参照してください。
これらのエンドポイントを使うには、読み取りまたは書き込みアクセス権を持つリポジトリ管理アクセス許可が GitHub Apps に必要です。
List all autolinks of a repository
This returns a list of autolinks configured for the given repository.
Information about autolinks are only available to repository administrators.
"List 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. The name is not case sensitive. |
クエリ パラメーター |
名前, Type, 説明 |
page integer Page number of the results to fetch. Default: |
"List all autolinks of a repository" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
"List all autolinks of a repository" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks
Response
Status: 200
[
{
"id": 1,
"key_prefix": "TICKET-",
"url_template": "https://example.com/TICKET?query=<num>"
}
]
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" のパラメーター
ヘッダー |
---|
名前, 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. The name is not case sensitive. |
本文のパラメーター |
名前, Type, 説明 |
key_prefix string 必須The prefix appended by a number 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>" \
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>"
}
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" のパラメーター
ヘッダー |
---|
名前, 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. The name is not case sensitive. |
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>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_ID
Response
Status: 200
{
"id": 1,
"key_prefix": "TICKET-",
"url_template": "https://example.com/TICKET?query=<num>"
}
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" のパラメーター
ヘッダー |
---|
名前, 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. The name is not case sensitive. |
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>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_ID
Response
Status: 204