이 버전의 GitHub Enterprise는 다음 날짜에 중단되었습니다. 2024-09-25. 중요한 보안 문제에 대해서도 패치 릴리스가 이루어지지 않습니다. 더 뛰어난 성능, 향상된 보안, 새로운 기능을 위해 최신 버전의 GitHub Enterprise Server로 업그레이드합니다. 업그레이드에 대한 도움말은 GitHub Enterprise 지원에 문의하세요.
GitHub Enterprise Server를 관리하기 위한 REST API 엔드포인트
GitHub Enterprise Server REST API를 사용하여 인스턴스를 관리합니다.
About the Manage GitHub Enterprise Server API
You can manage your GitHub Enterprise Server instance using the Manage GitHub Enterprise Server API. For example, you can retrieve information about the version of the GitHub Enterprise Server software running on the instance, or on instances with multiple nodes, view the status of replication.
Specify the port number when making API calls to endpoints for the Manage GitHub Enterprise Server API. If your instance uses TLS, the port number is 8443. Otherwise, the port number is 8080. If you cannot provide a port number, you'll need to configure your client to automatically follow redirects. For more information, see "Configuring TLS."
You can also use the GitHub Enterprise Server extension of the GitHub CLI to invoke endpoints in the Manage GitHub Enterprise Server API. For more information, see the github/gh-es
repository.
Authentication
To authenticate requests to endpoints for the Manage GitHub Enterprise Server API, specify the password for the instance's root site administrator account as an authentication token. Use standard HTTP authentication to send the password. The api_key
user identifies the root site administrator. The following example demonstrates authentication for this API. Replace ROOT-SITE-ADMINISTRATOR-PASSWORD with the password, and ADMINISTRATION-PORT with either 8443 or 8080.
curl -L -u "api_key:ROOT-SITE-ADMINISTRATOR-PASSWORD" 'http(s)://HOSTNAME:ADMINISTRATION-PORT/manage'
Authentication as a Management Console user
Management Console user accounts can also authenticate to access these endpoints. For more information, see "Managing access to the Management Console."
To authenticate with the password for a Management Console user account, use standard HTTP authentication. In the following example, replace YOUR_USER_NAME and YOUR_PASSWORD with the account's user name and password.
curl -L -u "YOUR_USER_NAME:YOUR_PASSWORD" 'http(s)://HOSTNAME:ADMINISTRATION-PORT/manage'
Query parameters
By default, the response includes information from about all configured nodes for the instance. On an instance with multiple nodes, the details originate from /data/user/common/cluster.conf
. You can use the following query parameters to filter the response for information about specific nodes.
Query parameter | Description |
---|---|
uuid | Unique identifier for the node. |
cluster_role | For nodes in a cluster, the roles that apply to the node. For more information, see "[AUTOTITLE)(/admin/enterprise-management/configuring-clustering/about-cluster-nodes)." |
You can specify multiple values for the query parameter by delimiting the values with a comma. For example, the following request uses curl to return any nodes with the web-server
or storage-server
role.
curl -L -u "api_key:ROOT-SITE-ADMINISTRATOR-PASSWORD" 'http(s)://HOSTNAME:ADMINISTRATION-PORT/manage/v1/config/nodes?cluster_role=WebServer,StorageServer'
Get GHES node metadata for all nodes
Get node metadata for all configured nodes in the current cluster. For more information, see "About clustering."
"Get GHES node metadata for all nodes"에 대한 매개 변수
속성, 형식, 설명 |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
"Get GHES node metadata for all nodes"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
"Get GHES node metadata for all nodes"에 대한 코드 샘플
요청 예제
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/config/nodes
Response
Status: 200
{
"topology": "Cluster",
"nodes": [
{
"hostname": "data1",
"uuid": "1b6cf518-f97c-11ed-8544-061d81f7eedb",
"cluster_roles": [
"ConsulServer",
"ElasticsearchServer",
"GitServer",
"StorageServer"
]
},
{
"hostname": "data2",
"uuid": "228406d4-f97c-11ed-ab01-062281bbcf03",
"cluster_roles": [
"ElasticsearchServer",
"StorageServer",
"PagesServer"
]
}
]
}
Get the status of maintenance mode
Gets the status and details of maintenance mode on all available nodes. For more information, see "Enabling and scheduling maintenance mode."
"Get the status of maintenance mode"에 대한 매개 변수
속성, 형식, 설명 |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
"Get the status of maintenance mode"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
"Get the status of maintenance mode"에 대한 코드 샘플
요청 예제
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/maintenance
Response
Status: 200
[
{
"hostname": "ghe-local-primary",
"uuid": "1b6cf518-f97c-11ed-8544-061d81f7eedb",
"status": "scheduled",
"scheduled_time": "2006-01-02T15:04:05+00:00",
"connection_services": [
{
"name": "git operations",
"number": 15
},
{
"name": "mysql queries",
"number": 6
},
{
"name": "resque jobs",
"number": 10
},
{
"name": "aqueduct jobs",
"number": 0
}
],
"can_unset_maintenance": true,
"ip_exception_list": [
"1.1.1.1"
],
"maintenance_mode_message": "Scheduled maintenance for upgrading."
}
]
Set the status of maintenance mode
Sets or schedules the maintenance mode. For more information, see "Enabling and scheduling maintenance mode."
"Set the status of maintenance mode"에 대한 매개 변수
속성, 형식, 설명 |
---|
enabled boolean RequiredWhether to enable maintenance mode. |
uuid string The UUID of the node to target. This parameter is incompatible with maintenance mode scheduling. Only use |
when string The time to enable maintenance mode. If this parameter is empty or set to |
ip_exception_list array of strings The list of IP addresses to exclude from maintenance mode. IPv4, IPv6, and CIDR addresses are supported. |
maintenance_mode_message string The message to display to users when maintenance mode is enabled. |
"Set the status of maintenance mode"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
500 | Internal error |
"Set the status of maintenance mode"에 대한 코드 샘플
요청 예제
curl -L \
-X POST \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/maintenance \
-d '{"enabled":true,"when":"2006-01-02T15:04:05+00:00","ip_exception_list":["192.168.1.0/24","1.1.1.1"]}'
Response
Get the status of services running on all replica nodes
Gets the status of all services running on each replica node. This endpoint may take several seconds to reply.
"Get the status of services running on all replica nodes"에 대한 매개 변수
속성, 형식, 설명 |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
"Get the status of services running on all replica nodes"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
"Get the status of services running on all replica nodes"에 대한 코드 샘플
요청 예제
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/replication/status
Response
Status: 200
{
"status": "OK",
"nodes": [
{
"hostname": "ghe-local-primary",
"status": "OK",
"services": []
},
{
"hostname": "ghe-local-replica",
"status": "OK",
"services": [
{
"status": "OK",
"name": "redis",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "elasticsearch",
"details": "cluster is in sync (0 shards initializing, 0 shards unassigned)"
},
{
"status": "OK",
"name": "git",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "pages",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "alambic",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "git-hooks",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "consul",
"details": "replication is in sync"
},
{
"status": "OK",
"name": "mysql",
"details": "replication is in sync"
}
]
}
]
}
Get all GHES release versions for all nodes
Gets the GitHub Enterprise Server release versions that are currently installed on all available nodes. For more information, see "GitHub Enterprise Server releases."
"Get all GHES release versions for all nodes"에 대한 매개 변수
속성, 형식, 설명 |
---|
uuid string The UUID which identifies a node. |
cluster_roles string The cluster roles from the cluster configuration file. |
"Get all GHES release versions for all nodes"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
401 | Unauthorized |
500 | Internal error |
"Get all GHES release versions for all nodes"에 대한 코드 샘플
요청 예제
curl -L \
-u "api_key:your-password" \
http(s)://HOSTNAME/manage/v1/version
Response