최근에 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"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
경로 매개 변수 |
속성, 형식, Description |
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. |
쿼리 매개 변수 |
속성, 형식, Description |
page integer Page number of the results to fetch. 기본값: |
"List all autolinks of a repository"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
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"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
경로 매개 변수 |
속성, 형식, Description |
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. |
본문 매개 변수 |
속성, 형식, Description |
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 기본값: |
"Create an autolink reference for a repository"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
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"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
경로 매개 변수 |
속성, 형식, Description |
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 응답 상태 코드
상태 코드 | Description |
---|---|
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"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
경로 매개 변수 |
속성, 형식, Description |
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 응답 상태 코드
상태 코드 | Description |
---|---|
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