URLs do ponto de extremidade
Pontos de extremidade da API REST são prefixados com a seguinte URL:
https://[hostname]/api/v3
Autenticação
Os endpoints de API da sua instalação do GitHub AE aceitam os mesmos métodos de autenticação da API do GitHub.com. Você pode efetuar a autenticação com tokens do OAuth ou autenticação básica.
Os pontos de extremidade da API da administração da empresa podem ser acessados por administradores do site de GitHub AEautenticados.
Informações da versão
A versão atual da sua empresa é retornada no cabeçalho de resposta de cada API: X-GitHub-Enterprise-Version: github-ae@latest.0 Você também pode ler a versão atual chamando o ponto de extremidade de meta.
GitHub Actions
Get GitHub Actions permissions for an enterprise
Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/permissions
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissionsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"enabled_organizations": "all",
"allowed_actions": "selected",
"selected_actions_url": "https://api.github.com/enterprises/2/actions/permissions/selected-actions"
}
Set GitHub Actions permissions for an enterprise
Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
enabled_organizations |
string | body |
Required. The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: |
allowed_actions |
string | body |
The permissions policy that controls the actions that are allowed to run. Can be one of: |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions \
-d '{"enabled_organizations":"enabled_organizations"}'JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions', {
enterprise: 'enterprise',
enabled_organizations: 'enabled_organizations'
})
Response
Status: 204 No Content
List selected organizations enabled for GitHub Actions in an enterprise
Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/permissions/organizations
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizationsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions/organizations', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"total_count": 1,
"organizations": [
{
"login": "octocat",
"id": 161335,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"url": "https://api.github.com/orgs/octo-org",
"repos_url": "https://api.github.com/orgs/octo-org/repos",
"events_url": "https://api.github.com/orgs/octo-org/events",
"hooks_url": "https://api.github.com/orgs/octo-org/hooks",
"issues_url": "https://api.github.com/orgs/octo-org/issues",
"members_url": "https://api.github.com/orgs/octo-org/members{/member}",
"public_members_url": "https://api.github.com/orgs/octo-org/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}
]
}
Set selected organizations enabled for GitHub Actions in an enterprise
Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions/organizations
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
selected_organization_ids |
array of integers | body |
Required. List of organization IDs to enable for GitHub Actions. |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations \
-d '{"selected_organization_ids":[42]}'JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/organizations', {
enterprise: 'enterprise',
selected_organization_ids: [
42
]
})
Response
Status: 204 No Content
Enable a selected organization for GitHub Actions in an enterprise
Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions/organizations/{org_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
org_id |
integer | path |
Unique identifier of an organization. |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations/42JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}', {
enterprise: 'enterprise',
org_id: 42
})
Response
Status: 204 No Content
Disable a selected organization for GitHub Actions in an enterprise
Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
delete /enterprises/{enterprise}/actions/permissions/organizations/{org_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
org_id |
integer | path |
Unique identifier of an organization. |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/organizations/42JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id}', {
enterprise: 'enterprise',
org_id: 42
})
Response
Status: 204 No Content
Get allowed actions for an enterprise
Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/permissions/selected-actions
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/selected-actionsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions/selected-actions', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"github_owned_allowed": true,
"verified_allowed": false,
"patterns_allowed": [
"monalisa/octocat@*",
"docker/*"
]
}
Set allowed actions for an enterprise
Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for allowed_actions must be configured to selected. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions/selected-actions
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
github_owned_allowed |
boolean | body |
Whether GitHub-owned actions are allowed. For example, this includes the actions in the |
verified_allowed |
boolean | body |
Whether actions in GitHub Marketplace from verified creators are allowed. Set to |
patterns_allowed |
array of strings | body |
Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/permissions/selected-actions \
-d '{"github_owned_allowed":true}'JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/selected-actions', {
enterprise: 'enterprise',
github_owned_allowed: true
})
Response
Status: 204 No Content
List self-hosted runner groups for an enterprise
Lists all self-hosted runner groups for an enterprise.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/runner-groups
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groupsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"total_count": 3,
"runner_groups": [
{
"id": 1,
"name": "Default",
"visibility": "all",
"default": true,
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/1/runners",
"allows_public_repositories": false
},
{
"id": 2,
"name": "octo-runner-group",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/2/runners",
"allows_public_repositories": true
},
{
"id": 3,
"name": "expensive-hardware",
"visibility": "private",
"default": false,
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/3/runners",
"allows_public_repositories": true
}
]
}
Create a self-hosted runner group for an enterprise
Creates a new self-hosted runner group for an enterprise.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
post /enterprises/{enterprise}/actions/runner-groups
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
name |
string | body |
Required. Name of the runner group. |
visibility |
string | body |
Visibility of a runner group. You can select all organizations or select individual organization. Can be one of: |
selected_organization_ids |
array of integers | body |
List of organization IDs that can access the runner group. |
runners |
array of integers | body |
List of runner IDs to add to the runner group. |
Amostras de código
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups \
-d '{"name":"name"}'JavaScript (@octokit/core.js)
await octokit.request('POST /enterprises/{enterprise}/actions/runner-groups', {
enterprise: 'enterprise',
name: 'name'
})
Response
Status: 201 Created
{
"id": 2,
"name": "octo-runner-group",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
"allows_public_repositories": false
}
Get a self-hosted runner group for an enterprise
Gets a specific self-hosted runner group for an enterprise.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path |
Unique identifier of the self-hosted runner group. |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
enterprise: 'enterprise',
runner_group_id: 42
})
Response
Status: 200 OK
{
"id": 2,
"name": "octo-runner-group",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
"allows_public_repositories": false
}
Update a self-hosted runner group for an enterprise
Updates the name and visibility of a self-hosted runner group in an enterprise.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
patch /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path |
Unique identifier of the self-hosted runner group. |
name |
string | body |
Name of the runner group. |
visibility |
string | body |
Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: all |
Amostras de código
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42 \
-d '{"name":"name"}'JavaScript (@octokit/core.js)
await octokit.request('PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
enterprise: 'enterprise',
runner_group_id: 42,
name: 'name'
})
Response
Status: 200 OK
{
"id": 2,
"name": "Expensive hardware runners",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
"allows_public_repositories": true
}
Delete a self-hosted runner group from an enterprise
Deletes a self-hosted runner group for an enterprise.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
delete /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path |
Unique identifier of the self-hosted runner group. |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
enterprise: 'enterprise',
runner_group_id: 42
})
Response
Status: 204 No Content
List self-hosted runners in a group for an enterprise
Lists the self-hosted runners that are in a specific enterprise group.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path |
Unique identifier of the self-hosted runner group. |
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runnersJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners', {
enterprise: 'enterprise',
runner_group_id: 42
})
Response
Status: 200 OK
{
"total_count": 2,
"runners": [
{
"id": 23,
"name": "linux_runner",
"os": "linux",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 11,
"name": "Linux",
"type": "read-only"
}
]
},
{
"id": 24,
"name": "mac_runner",
"os": "macos",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
]
}
Set self-hosted runners in a group for an enterprise
Replaces the list of self-hosted runners that are part of an enterprise runner group.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
put /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path |
Unique identifier of the self-hosted runner group. |
runners |
array of integers | body |
Required. List of runner IDs to add to the runner group. |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runners \
-d '{"runners":[42]}'JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners', {
enterprise: 'enterprise',
runner_group_id: 42,
runners: [
42
]
})
Response
Status: 204 No Content
Add a self-hosted runner to a group for an enterprise
Adds a self-hosted runner to a runner group configured in an enterprise.
You must authenticate using an access token with the manage_runners:enterprise
scope to use this endpoint.
put /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path |
Unique identifier of the self-hosted runner group. |
runner_id |
integer | path |
Unique identifier of the self-hosted runner. |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runners/42JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}', {
enterprise: 'enterprise',
runner_group_id: 42,
runner_id: 42
})
Response
Status: 204 No Content
Remove a self-hosted runner from a group for an enterprise
Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
delete /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path |
Unique identifier of the self-hosted runner group. |
runner_id |
integer | path |
Unique identifier of the self-hosted runner. |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runner-groups/42/runners/42JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}', {
enterprise: 'enterprise',
runner_group_id: 42,
runner_id: 42
})
Response
Status: 204 No Content
List self-hosted runners for an enterprise
Lists all self-hosted runners configured for an enterprise.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/runners
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runnersJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runners', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"total_count": 2,
"runners": [
{
"id": 23,
"name": "linux_runner",
"os": "linux",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 11,
"name": "Linux",
"type": "read-only"
}
]
},
{
"id": 24,
"name": "mac_runner",
"os": "macos",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
]
}
Get a self-hosted runner for an enterprise
Gets a specific self-hosted runner configured in an enterprise.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
get /enterprises/{enterprise}/actions/runners/{runner_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id |
integer | path |
Unique identifier of the self-hosted runner. |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runners/42JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runners/{runner_id}', {
enterprise: 'enterprise',
runner_id: 42
})
Response
Status: 200 OK
{
"id": 23,
"name": "MBP",
"os": "macos",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
Delete a self-hosted runner from an enterprise
Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
You must authenticate using an access token with the manage_runners:enterprise scope to use this endpoint.
delete /enterprises/{enterprise}/actions/runners/{runner_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
enterprise |
string | path |
The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id |
integer | path |
Unique identifier of the self-hosted runner. |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprises/ENTERPRISE/actions/runners/42JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runners/{runner_id}', {
enterprise: 'enterprise',
runner_id: 42
})
Response
Status: 204 No Content
Estatísticas de admin
A API de Estatísticas Administrativas fornece uma variedade de métricas sobre sua instalação. Só está disponível para administradores do site autenticados. Usuários normais receberão uma mensagem 404 se tentarem acessá-la.
get /enterprise/stats/all
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/allJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/all')
Response
Status: 200 OK
{
"repos": {
"total_repos": 212,
"root_repos": 194,
"fork_repos": 18,
"org_repos": 51,
"total_pushes": 3082,
"total_wikis": 15
},
"hooks": {
"total_hooks": 27,
"active_hooks": 23,
"inactive_hooks": 4
},
"pages": {
"total_pages": 36
},
"orgs": {
"total_orgs": 33,
"disabled_orgs": 0,
"total_teams": 60,
"total_team_members": 314
},
"users": {
"total_users": 254,
"admin_users": 45,
"suspended_users": 21
},
"pulls": {
"total_pulls": 86,
"merged_pulls": 60,
"mergeable_pulls": 21,
"unmergeable_pulls": 3
},
"issues": {
"total_issues": 179,
"open_issues": 83,
"closed_issues": 96
},
"milestones": {
"total_milestones": 7,
"open_milestones": 6,
"closed_milestones": 1
},
"gists": {
"total_gists": 178,
"private_gists": 151,
"public_gists": 25
},
"comments": {
"total_commit_comments": 6,
"total_gist_comments": 28,
"total_issue_comments": 366,
"total_pull_request_comments": 30
}
}
get /enterprise/stats/comments
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/commentsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/comments')
Response
Status: 200 OK
get /enterprise/stats/gists
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/gistsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/gists')
Response
Status: 200 OK
get /enterprise/stats/hooks
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/hooksJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/hooks')
Response
Status: 200 OK
get /enterprise/stats/issues
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/issuesJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/issues')
Response
Status: 200 OK
get /enterprise/stats/milestones
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/milestonesJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/milestones')
Response
Status: 200 OK
get /enterprise/stats/orgs
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/orgsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/orgs')
Response
Status: 200 OK
get /enterprise/stats/pages
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/pagesJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/pages')
Response
Status: 200 OK
get /enterprise/stats/pulls
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/pullsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/pulls')
Response
Status: 200 OK
get /enterprise/stats/repos
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/reposJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/repos')
Response
Status: 200 OK
get /enterprise/stats/users
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/stats/usersJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/users')
Response
Status: 200 OK
Anúncios
A API de anúncios permite que você gerencie o banner de anúncio global na sua empresa. Para obter mais informações, consulte "Personalizar mensagens de usuários para a sua empresa".
Get the global announcement banner
Gets the current message and expiration date of the global announcement banner in your enterprise.
get /enterprise/announcement
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/announcementJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/announcement')
Default response
Status: 200 OK
{
"announcement": "Very **important** announcement about _nothing_.",
"expires_at": "2021-01-01T00:00:00.000+00:00"
}
Set the global announcement banner
Sets the message and expiration time for the global announcement banner in your enterprise.
patch /enterprise/announcement
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
announcement |
string | body |
Required. The announcement text in GitHub Flavored Markdown. For more information about GitHub Flavored Markdown, see "Mastering markdown." |
expires_at |
string or nullable | body |
The time at which the announcement expires. This is a timestamp in ISO 8601 format: |
Amostras de código
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/announcement \
-d '{"announcement":"announcement"}'JavaScript (@octokit/core.js)
await octokit.request('PATCH /enterprise/announcement', {
announcement: 'announcement'
})
Default response
Status: 200 OK
{
"announcement": "Very **important** announcement about _nothing_.",
"expires_at": "2021-01-01T00:00:00.000+00:00"
}
delete /enterprise/announcement
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/announcementJavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprise/announcement')
Response
Status: 204 No Content
Webhooks globais
Webhooks globais são instalados na sua empresa. Você pode usar webhooks globais para monitorar, responder ou aplicar regras automaticamente para usuários, organizações, equipes e repositórios na sua empresa. Webhooks globais podem se inscrever para os tipos de eventos organização, usuário, repositório, equipe, integrante, filiação, bifurcaçãoe ping.
Esta API está disponível somente para administradores do site autenticados. Usuários normais receberão uma mensagem 404 se tentarem acessá-la. Para aprender como configurar webhooks globais, consulte Sobre webhooks globais.
get /admin/hooks
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change.Ver aviso de pré-visualização |
accept |
string | header |
This API is under preview and subject to change. Default:application/vnd.github.superpro-preview+json |
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://{hostname}/api/v3/admin/hooksJavaScript (@octokit/core.js)
await octokit.request('GET /admin/hooks', {
mediaType: {
previews: [
'superpro'
]
}
})
Response
Status: 200 OK
[
{
"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://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
]
Aviso de pré-visualização
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+json☝️Este cabeçalho é obrigatório.post /admin/hooks
Parâmetros
| Name | Type | In | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change.Ver aviso de pré-visualização |
||||||||
accept |
string | header |
This API is under preview and subject to change. Default:application/vnd.github.superpro-preview+json |
||||||||
name |
string | body |
Required. Must be passed as "web". |
||||||||
config |
object | body |
Required. Key/value pairs to provide settings for this webhook. |
||||||||
Properties of the
|
|||||||||||
url (string)
|
Required. 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 |
eventsThe events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.
activeDetermines if notifications are sent when the webhook is triggered. Set to true to send notifications.
trueAmostras de código
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://{hostname}/api/v3/admin/hooks \
-d '{"name":"name","config":{"url":"url","content_type":"content_type","secret":"secret","insecure_ssl":"insecure_ssl"}}'JavaScript (@octokit/core.js)
await octokit.request('POST /admin/hooks', {
name: 'name',
config: {
url: 'url',
content_type: 'content_type',
secret: 'secret',
insecure_ssl: 'insecure_ssl'
},
mediaType: {
previews: [
'superpro'
]
}
})
Response
Status: 201 Created
{
"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://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
Aviso de pré-visualização
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+json☝️Este cabeçalho é obrigatório.get /admin/hooks/{hook_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change.Ver aviso de pré-visualização |
accept |
string | header |
This API is under preview and subject to change. Default:application/vnd.github.superpro-preview+json |
hook_id |
integer | path |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://{hostname}/api/v3/admin/hooks/42JavaScript (@octokit/core.js)
await octokit.request('GET /admin/hooks/{hook_id}', {
hook_id: 42,
mediaType: {
previews: [
'superpro'
]
}
})
Response
Status: 200 OK
{
"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://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
Aviso de pré-visualização
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+json☝️Este cabeçalho é obrigatório.Update a global webhook
Parameters that are not provided will be overwritten with the default value or removed if no default exists.
patch /admin/hooks/{hook_id}
Parâmetros
| Name | Type | In | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change.Ver aviso de pré-visualização |
||||||||
accept |
string | header |
This API is under preview and subject to change. Default:application/vnd.github.superpro-preview+json |
||||||||
hook_id |
integer | path | |||||||||
config |
object | body |
Key/value pairs to provide settings for this webhook. |
||||||||
Properties of the
|
|||||||||||
url (string)
|
Required. 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 |
eventsThe events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.
activeDetermines if notifications are sent when the webhook is triggered. Set to true to send notifications.
trueAmostras de código
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://{hostname}/api/v3/admin/hooks/42 \
-d '{"config":{"url":"url","content_type":"content_type","secret":"secret","insecure_ssl":"insecure_ssl"}}'JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/hooks/{hook_id}', {
hook_id: 42,
config: {
url: 'url',
content_type: 'content_type',
secret: 'secret',
insecure_ssl: 'insecure_ssl'
},
mediaType: {
previews: [
'superpro'
]
}
})
Response
Status: 200 OK
{
"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://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
Aviso de pré-visualização
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+json☝️Este cabeçalho é obrigatório.delete /admin/hooks/{hook_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change.Ver aviso de pré-visualização |
accept |
string | header |
This API is under preview and subject to change. Default:application/vnd.github.superpro-preview+json |
hook_id |
integer | path |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://{hostname}/api/v3/admin/hooks/42JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/hooks/{hook_id}', {
hook_id: 42,
mediaType: {
previews: [
'superpro'
]
}
})
Response
Status: 204 No Content
Aviso de pré-visualização
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+json☝️Este cabeçalho é obrigatório.Ping a global webhook
This will trigger a ping event to be sent to the webhook.
post /admin/hooks/{hook_id}/pings
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change.Ver aviso de pré-visualização |
accept |
string | header |
This API is under preview and subject to change. Default:application/vnd.github.superpro-preview+json |
hook_id |
integer | path |
Amostras de código
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://{hostname}/api/v3/admin/hooks/42/pingsJavaScript (@octokit/core.js)
await octokit.request('POST /admin/hooks/{hook_id}/pings', {
hook_id: 42,
mediaType: {
previews: [
'superpro'
]
}
})
Response
Status: 204 No Content
Aviso de pré-visualização
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+json☝️Este cabeçalho é obrigatório.Licença
A API de Licença fornece informações sobre sua licença empresarial. Só está disponível para administradores do site autenticados. Usuários normais receberão uma mensagem 404 se tentarem acessá-la.
get /enterprise/settings/license
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/enterprise/settings/licenseJavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/settings/license')
Response
Status: 200 OK
{
"seats": 1400,
"seats_used": 1316,
"seats_available": 84,
"kind": "standard",
"days_until_expiration": 365,
"expire_at": "2016/02/06 12:41:52 -0600"
}
Organizações
A API de administração da organização permite a criação de organizações na sua empresa. Só está disponível para administradores do site autenticados. Usuários normais receberão uma mensagem 404 se tentarem acessá-la.
post /admin/organizations
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
login |
string | body |
Required. The organization's username. |
admin |
string | body |
Required. The login of the user who will manage this organization. |
profile_name |
string | body |
The organization's display name. |
Amostras de código
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/organizations \
-d '{"login":"login","admin":"admin"}'JavaScript (@octokit/core.js)
await octokit.request('POST /admin/organizations', {
login: 'login',
admin: 'admin'
})
Response
Status: 201 Created
{
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"repos_url": "https://api.github.com/orgs/github/repos",
"events_url": "https://api.github.com/orgs/github/events",
"hooks_url": "https://api.github.com/orgs/github/hooks",
"issues_url": "https://api.github.com/orgs/github/issues",
"members_url": "https://api.github.com/orgs/github/members{/member}",
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}
patch /admin/organizations/{org}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
org |
string | path | |
login |
string | body |
Required. The organization's new name. |
Amostras de código
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/organizations/ORG \
-d '{"login":"login"}'JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/organizations/{org}', {
org: 'org',
login: 'login'
})
Response
Status: 202 Accepted
{
"message": "Job queued to rename organization. It may take a few minutes to complete.",
"url": "https://<hostname>/api/v3/organizations/1"
}
Usuários
A API de Administração do Usuário permite que você suspenda e cancele a suspensão dos usuários da sua empresa. Só está disponível para administradores do site autenticados. Usuários normais receberão uma mensagem 403 se tentarem acessá-la.
get /admin/keys
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
direction |
string | query |
One of desc |
sort |
string | query |
Default: created |
since |
string | query |
Only show public keys accessed after the given time. |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/keysJavaScript (@octokit/core.js)
await octokit.request('GET /admin/keys')
Response
Status: 200 OK
[
{
"key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234",
"id": 2,
"url": "https://api.github.com/user/keys/2",
"title": "ssh-rsa AAAAB3NzaC1yc2EAAA",
"created_at": "2020-06-11T21:31:57Z",
"verified": false,
"read_only": false,
"last_used": "2020-06-11T22:31:57Z",
"user_id": 1,
"repository_id": 2
},
{
"key": "9Og8iYjAyymI9LvABpJerYrMxURPc8r+dB7TJyvv1234",
"id": 3,
"url": "https://api.github.com/user/keys/2",
"title": "ssh-rsa AAAAB3NzaC1yc2EAAA",
"created_at": "2020-06-11T21:31:57Z",
"verified": false,
"read_only": false,
"last_used": "2020-06-11T22:31:57Z",
"user_id": 1,
"repository_id": 2
}
]
delete /admin/keys/{key_ids}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
key_ids |
string | path |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/keys/KEY_IDSJavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/keys/{key_ids}', {
key_ids: 'key_ids'
})
Response
Status: 204 No Content
get /admin/tokens
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Amostras de código
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/tokensJavaScript (@octokit/core.js)
await octokit.request('GET /admin/tokens')
Response
Status: 200 OK
[
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo"
],
"token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
"token_last_eight": "Ae178B4a",
"hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"note": "optional note",
"note_url": "http://optional/note/url",
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"expires_at": "2011-09-08T17:26:27Z",
"fingerprint": "jklmnop12345678"
}
]
Delete a personal access token
Deletes a personal access token. Returns a 403 - Forbidden status when a personal access token is in use. For example, if you access this endpoint with the same personal access token that you are trying to delete, you will receive this error.
delete /admin/tokens/{token_id}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
token_id |
integer | path |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/tokens/42JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/tokens/{token_id}', {
token_id: 42
})
Response
Status: 204 No Content
Delete a user
Deleting a user will delete all their repositories, gists, applications, and personal settings. Suspending a user is often a better option.
You can delete any user account except your own.
delete /admin/users/{username}
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
username |
string | path |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/users/USERNAMEJavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/users/{username}', {
username: 'username'
})
Response
Status: 204 No Content
post /admin/users/{username}/authorizations
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
username |
string | path | |
scopes |
array of strings | body |
A list of scopes. |
Amostras de código
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/users/USERNAME/authorizations \
-d '{"scopes":["scopes"]}'JavaScript (@octokit/core.js)
await octokit.request('POST /admin/users/{username}/authorizations', {
username: 'username',
scopes: [
'scopes'
]
})
Response
Status: 201 Created
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo"
],
"token": "ghu_16C7e42F292c6912E7710c838347Ae178B4a",
"token_last_eight": "Ae178B4a",
"hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
"app": {
"url": "http://my-github-app.com",
"name": "my github app",
"client_id": "abcde12345fghij67890"
},
"note": "optional note",
"note_url": "http://optional/note/url",
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z",
"expires_at": "2011-10-06T17:26:27Z",
"fingerprint": ""
}
delete /admin/users/{username}/authorizations
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
username |
string | path |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/admin/users/USERNAME/authorizationsJavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/users/{username}/authorizations', {
username: 'username'
})
Response
Status: 204 No Content
Suspend a user
If your GitHub instance uses LDAP Sync with Active Directory LDAP servers, Active Directory LDAP-authenticated users cannot be suspended through this API. If you attempt to suspend an Active Directory LDAP-authenticated user through this API, it will return a 403 response.
You can suspend any user account except your own.
Note that, if you choose not to pass any parameters, you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."
put /users/{username}/suspended
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
username |
string | path | |
reason |
string | body |
The reason the user is being suspended. This message will be logged in the audit log. If you don't provide a |
Amostras de código
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/users/USERNAME/suspended \
-d '{"reason":"reason"}'JavaScript (@octokit/core.js)
await octokit.request('PUT /users/{username}/suspended', {
username: 'username',
reason: 'reason'
})
Response
Status: 204 No Content
Unsuspend a user
If your GitHub instance uses LDAP Sync with Active Directory LDAP servers, this API is disabled and will return a 403 response. Active Directory LDAP-authenticated users cannot be unsuspended using the API.
delete /users/{username}/suspended
Parâmetros
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
username |
string | path | |
reason |
string | body |
The reason the user is being unsuspended. This message will be logged in the audit log. If you don't provide a |
Amostras de código
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://{hostname}/api/v3/users/USERNAME/suspended \
-d '{"reason":"reason"}'JavaScript (@octokit/core.js)
await octokit.request('DELETE /users/{username}/suspended', {
username: 'username',
reason: 'reason'
})
Response
Status: 204 No Content