최근에 REST API 설명서 중 일부를 이동했습니다. 원하는 항목을 찾을 수 없는 경우 동작 REST API 페이지를 사용해 볼 수 있습니다.
전역 webhook
REST API를 사용하여 엔터프라이즈의 글로벌 웹후크를 관리합니다.
전역 웹후크 정보
이러한 엔드포인트는 인증된 사이트 관리자에게만 사용할 수 있습니다. 일반 사용자는 응답을 받게 됩니다 404
. 전역 웹후크를 구성하는 방법을 알아보려면 전역 웹후크 정보를 참조하세요.
전역 웹후크는 엔터프라이즈에 자동으로 설치됩니다. 전역 웹후크를 사용하여 엔터프라이즈의 사용자, 조직, 팀 및 리포지토리에 대한 규칙을 자동으로 모니터링하거나 적용하고 대응할 수 있습니다.
전역 웹후크는 조직, 사용자, 리포지토리, 팀, 구성원, 멤버 자격, 포크 및 ping 이벤트 유형을 구독할 수 있습니다.
List global webhooks
"List global webhooks"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
쿼리 매개 변수 |
속성, 형식, Description |
per_page integer The number of results per page (max 100). 기본값: |
page integer Page number of the results to fetch. 기본값: |
"List global webhooks"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
200 | OK |
"List global webhooks"에 대한 코드 샘플
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks
Response
Status: 200
[
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}
]
Create a global webhook
"Create a global webhook"에 대한 매개 변수
헤더 | ||||||||
---|---|---|---|---|---|---|---|---|
속성, 형식, Description | ||||||||
accept string Setting to | ||||||||
본문 매개 변수 | ||||||||
속성, 형식, Description | ||||||||
name string 필수Must be passed as "web". | ||||||||
config object 필수Key/value pairs to provide settings for this webhook. | ||||||||
Properties of |
속성, 형식, Description |
---|
url string 필수The URL to which the payloads will be delivered. |
content_type string The media type used to serialize the payloads. Supported values include |
secret string If provided, the |
insecure_ssl string Determines whether the SSL certificate of the host for |
events
array of strings The events that trigger this webhook. A global webhook can be triggered by user
and organization
events. Default: user
and organization
.
active
boolean Determines if notifications are sent when the webhook is triggered. Set to true
to send notifications.
기본값: true
"Create a global webhook"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
201 | Created |
"Create a global webhook"에 대한 코드 샘플
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks \
-d '{"name":"web","events":["organization","user"],"config":{"url":"https://example.com/webhook","content_type":"json","secret":"secret"}}'
Response
Status: 201
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}
Get a global webhook
"Get a global webhook"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
경로 매개 변수 |
속성, 형식, Description |
hook_id integer 필수The unique identifier of the hook. |
"Get a global webhook"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
200 | OK |
"Get a global webhook"에 대한 코드 샘플
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID
Response
Status: 200
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}
Update a global webhook
Parameters that are not provided will be overwritten with the default value or removed if no default exists.
"Update a global webhook"에 대한 매개 변수
헤더 | ||||||||
---|---|---|---|---|---|---|---|---|
속성, 형식, Description | ||||||||
accept string Setting to | ||||||||
경로 매개 변수 | ||||||||
속성, 형식, Description | ||||||||
hook_id integer 필수The unique identifier of the hook. | ||||||||
본문 매개 변수 | ||||||||
속성, 형식, Description | ||||||||
config object Key/value pairs to provide settings for this webhook. | ||||||||
Properties of |
속성, 형식, Description |
---|
url string 필수The URL to which the payloads will be delivered. |
content_type string The media type used to serialize the payloads. Supported values include |
secret string If provided, the |
insecure_ssl string Determines whether the SSL certificate of the host for |
events
array of strings The events that trigger this webhook. A global webhook can be triggered by user
and organization
events. Default: user
and organization
.
active
boolean Determines if notifications are sent when the webhook is triggered. Set to true
to send notifications.
기본값: true
"Update a global webhook"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
200 | OK |
"Update a global webhook"에 대한 코드 샘플
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID \
-d '{"events":["organization"],"config":{"url":"https://example.com/webhook"}}'
Response
Status: 200
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization"
],
"config": {
"url": "https://example.com",
"content_type": "form",
"insecure_ssl": "0"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}
Delete a global webhook
"Delete a global webhook"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
경로 매개 변수 |
속성, 형식, Description |
hook_id integer 필수The unique identifier of the hook. |
"Delete a global webhook"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
204 | No Content |
"Delete a global webhook"에 대한 코드 샘플
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID
Response
Status: 204
Ping a global webhook
This will trigger a ping event to be sent to the webhook.
"Ping a global webhook"에 대한 매개 변수
헤더 |
---|
속성, 형식, Description |
accept string Setting to |
경로 매개 변수 |
속성, 형식, Description |
hook_id integer 필수The unique identifier of the hook. |
"Ping a global webhook"에 대한 HTTP 응답 상태 코드
상태 코드 | Description |
---|---|
204 | No Content |
"Ping a global webhook"에 대한 코드 샘플
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID/pings
Response
Status: 204