Skip to main content

We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the Actions REST API page.

许可证

许可 API 提供有关企业许可的信息。

它仅适用于经过身份验证的网站管理员。 如果普通用户尝试访问它,他们将收到 404 响应。

List enterprise consumed licenses

Lists the license consumption information for all users, including those from connected servers, associated with an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the read:enterprise scope.

Note: The license consumption API endpoints for enterprise accounts are currently in Beta and are subject to change.

参数

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
enterprisestringRequired

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

Query parameters
Name, Type, Description
per_pageinteger

The number of results per page (max 100).

Default: 30

pageinteger

Page number of the results to fetch.

Default: 1

HTTP 响应状态代码

状态代码说明
200

Consumed Licenses Response

代码示例

get/enterprises/{enterprise}/consumed-licenses
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://api.github.com/enterprises/ENTERPRISE/consumed-licenses

Consumed Licenses Response

Status: 200
{ "total_seats_consumed": 5000, "total_seats_purchased": 4500, "users": [ { "enterprise_server_emails": [ "monalisa@github.com" ], "github_com_login": "monalisa", "github_com_name": "Mona Lisa", "github_com_profile": "https://github.com/monalisa", "license_type": "enterprise", "github_com_member_roles": [ "org1:Owner", "org2:Owner" ], "github_com_enterprise_role": "owner", "github_com_enterprise_roles": [ "owner" ], "visual_studio_subscription_user": false, "github_com_verified_domain_emails": [ "monalisa@github.com" ], "github_com_saml_name_id": "monalisa", "enterprise_server_user": true, "github_com_user": true, "total_user_accounts": 3, "enterprise_server_user_ids": [ "example_host_name.com:123", "example_host_name_2:222" ], "github_com_orgs_with_pending_invites": [ "org1", "org2" ], "visual_studio_subscription_email": "" }, { "enterprise_server_emails": [ "deleonjavier@example.com" ], "github_com_login": "", "github_com_name": "", "github_com_profile": "", "license_type": "enterprise", "github_com_member_roles": [], "github_com_enterprise_role": "", "github_com_enterprise_roles": [], "visual_studio_subscription_user": false, "github_com_verified_domain_emails": [], "github_com_saml_name_id": "", "enterprise_server_user": true, "github_com_user": false, "total_user_accounts": 1, "enterprise_server_user_ids": [ "example_host_name:123" ], "github_com_orgs_with_pending_invites": [], "visual_studio_subscription_email": "" } ] }

Get a license sync status

Gets information about the status of a license sync job for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the read:enterprise scope.

参数

Headers
Name, Type, Description
acceptstring

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

Path parameters
Name, Type, Description
enterprisestringRequired

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

HTTP 响应状态代码

状态代码说明
200

License Sync Status Response

代码示例

get/enterprises/{enterprise}/license-sync-status
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://api.github.com/enterprises/ENTERPRISE/license-sync-status

License Sync Status Response

Status: 200
{ "server_instances": [ { "server_id": "deadbeef1", "hostname": "github.example.com", "last_sync": { "date": "2020-01-01T00:00:00Z", "status": "success", "error": "" } }, { "server_id": "filetoffish1", "hostname": "github2.example.com", "last_sync": { "date": "2020-01-01T00:00:00Z", "status": "success", "error": "" } } ] }