Skip to main content
ドキュメントには頻繁に更新が加えられ、その都度公開されています。本ページの翻訳はまだ未完成な部分があることをご了承ください。最新の情報については、英語のドキュメンテーションをご参照ください。本ページの翻訳に問題がある場合はこちらまでご連絡ください。
GitHub AEは、現在限定リリース中です。詳細については営業チームにお問い合わせください。

We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the new Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks REST API pages.

リポジトリの自動リンク

ワークフローを合理化するために、このAPIを使ってJIRAのIssueやZendeskのチケットのような外部リソースへの自動リンクを追加できます。

詳しい情報については「外部リソースを参照する自動リンクの設定」を参照してください。

GitHub AppsがAutolinks APIを使うためには、読み書きのアクセス付きのリポジトリ管理権限が必要です。

Works with GitHub Apps

This returns a list of autolinks configured for the given repository.

Information about autolinks are only available to repository administrators.

Headers
名前, 種類, 説明
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Path parameters
名前, 種類, 説明
ownerstring必須

The account owner of the repository. The name is not case sensitive.

repostring必須

The name of the repository. The name is not case sensitive.

クエリパラメータ
名前, 種類, 説明
pageinteger

Page number of the results to fetch.

デフォルト: 1

Status code説明
200

OK

get/repos/{owner}/{repo}/autolinks
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks

Response

Status: 200
[ { "id": 1, "key_prefix": "TICKET-", "url_template": "https://example.com/TICKET?query=<num>" } ]
Works with GitHub Apps

Users with admin access to the repository can create an autolink.

Headers
名前, 種類, 説明
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Path parameters
名前, 種類, 説明
ownerstring必須

The account owner of the repository. The name is not case sensitive.

repostring必須

The name of the repository. The name is not case sensitive.

Body parameters
名前, 種類, 説明
key_prefixstring必須

The prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.

url_templatestring必須

The URL must contain for the reference number.

Status code説明
201

Created

422

Validation failed

post/repos/{owner}/{repo}/autolinks
curl \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks \ -d '{"key_prefix":"TICKET-","url_template":"https://example.com/TICKET?query=<num>"}'

response

Status: 201
{ "id": 1, "key_prefix": "TICKET-", "url_template": "https://example.com/TICKET?query=<num>" }
Works with GitHub Apps

This returns a single autolink reference by ID that was configured for the given repository.

Information about autolinks are only available to repository administrators.

Headers
名前, 種類, 説明
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Path parameters
名前, 種類, 説明
ownerstring必須

The account owner of the repository. The name is not case sensitive.

repostring必須

The name of the repository. The name is not case sensitive.

autolink_idinteger必須

The unique identifier of the autolink.

Status code説明
200

OK

404

Resource not found

get/repos/{owner}/{repo}/autolinks/{autolink_id}
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ https://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>" }
Works with GitHub Apps

This deletes a single autolink reference by ID that was configured for the given repository.

Information about autolinks are only available to repository administrators.

Headers
名前, 種類, 説明
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Path parameters
名前, 種類, 説明
ownerstring必須

The account owner of the repository. The name is not case sensitive.

repostring必須

The name of the repository. The name is not case sensitive.

autolink_idinteger必須

The unique identifier of the autolink.

Status code説明
204

No Content

404

Resource not found

delete/repos/{owner}/{repo}/autolinks/{autolink_id}
curl \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ https://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_ID

Response

Status: 204