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のチケットのような外部リソースへの自動リンクを追加できます。
Repository autolinks APIについて
詳しい情報については「外部リソースを参照する自動リンクの設定」を参照してください。
GitHub AppsがAutolinks APIを使うためには、読み書きのアクセス付きのリポジトリ管理権限が必要です。
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.
パラメータ
Headers |
---|
名前, 種類, 説明 |
accept stringSetting to |
Path parameters |
名前, 種類, 説明 |
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. |
クエリパラメータ |
名前, 種類, 説明 |
page integerPage number of the results to fetch. デフォルト: |
HTTP response status codes
Status code | 説明 |
---|---|
200 | OK |
コードサンプル
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <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.
パラメータ
Headers |
---|
名前, 種類, 説明 |
accept stringSetting to |
Path parameters |
名前, 種類, 説明 |
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. |
Body parameters |
名前, 種類, 説明 |
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 |
HTTP response status codes
Status code | 説明 |
---|---|
201 | Created |
422 | Validation failed |
コードサンプル
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <TOKEN>" \
http(s)://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>"
}
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.
パラメータ
Headers |
---|
名前, 種類, 説明 |
accept stringSetting to |
Path parameters |
名前, 種類, 説明 |
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. |
HTTP response status codes
Status code | 説明 |
---|---|
200 | OK |
404 | Resource not found |
コードサンプル
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <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.
パラメータ
Headers |
---|
名前, 種類, 説明 |
accept stringSetting to |
Path parameters |
名前, 種類, 説明 |
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. |
HTTP response status codes
Status code | 説明 |
---|---|
204 | No Content |
404 | Resource not found |
コードサンプル
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/autolinks/AUTOLINK_ID
Response
Status: 204