Pontos de extremidade de API REST para equipes
Use a API REST para criar e gerenciar equipes em sua organização GitHub Enterprise Server.
Sobre equipes
Esses pontos de extremidade só estão disponíveis para os membros autenticados da organização da equipe. Os tokens de acesso OAuth exigem o read:org
escopo . O GitHub gera o slug
da equipe com base no name
da equipe.
Quando as permissões pull
e push
forem aceitas, elas serão mapeadas para as funções de Leitura e Gravação de um repositório da organização. Para saber mais sobre funções de repositório, confira "Funções de repositório para uma organização".
List teams
Lists all teams in an organization that are visible to the authenticated user.
Tokens de acesso refinados para "List teams"
Esse ponto de extremidade funciona com os seguintes tipos de token refinados:
- Tokens de acesso de usuário do aplicativo GitHub
- Tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Members" organization permissions (read)
Parâmetros para "List teams"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List teams"
Código de status | Descrição |
---|---|
200 | OK |
403 | Forbidden |
Exemplos de código para "List teams"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams
Response
Status: 200
[
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"parent": null
}
]
Create a team
To create a team, the authenticated user must be a member or owner of {org}
. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "Setting team creation permissions."
When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of maintainers
. For more information, see "About teams".
Tokens de acesso refinados para "Create a team"
Esse ponto de extremidade funciona com os seguintes tipos de token refinados:
- Tokens de acesso de usuário do aplicativo GitHub
- Tokens de acesso à instalação do aplicativo GitHub
- Tokens de acesso pessoal refinados
O token refinado deve ter os seguintes conjuntos de permissões:
- "Members" organization permissions (write)
Parâmetros para "Create a team"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
Nome, Tipo, Descrição |
---|
name string ObrigatórioThe name of the team. |
description string The description of the team. |
maintainers array of strings List GitHub IDs for organization members who will become team maintainers. |
repo_names array of strings The full name (e.g., "organization-name/repository-name") of repositories to add the team to. |
privacy string The level of privacy this team should have. The options are:
Pode ser um dos: |
notification_setting string The notification setting the team has chosen. The options are:
Pode ser um dos: |
permission string Closing down notice. The permission that new repositories will be added to the team with when none is specified. Padrão: Pode ser um dos: |
parent_team_id integer The ID of a team to set as the parent team. |
ldap_dn string The distinguished name (DN) of the LDAP entry to map to a team. LDAP synchronization must be enabled to map LDAP entries to a team. Use the "Update LDAP mapping for a team" endpoint to change the LDAP DN. For more information, see "Using LDAP." |
Códigos de status de resposta HTTP para "Create a team"
Código de status | Descrição |
---|---|
201 | Created |
403 | Forbidden |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Create a team"
Exemplo de solicitação
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams \
-d '{"name":"Justice League","description":"A great team","permission":"push","notification_setting":"notifications_enabled","privacy":"closed"}'
Response
Status: 201
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"members_count": 3,
"repos_count": 10,
"created_at": "2017-07-14T16:53:42Z",
"updated_at": "2017-08-17T12:37:15Z",
"organization": {
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://HOSTNAME/orgs/github",
"repos_url": "https://HOSTNAME/orgs/github/repos",
"events_url": "https://HOSTNAME/orgs/github/events",
"hooks_url": "https://HOSTNAME/orgs/github/hooks",
"issues_url": "https://HOSTNAME/orgs/github/issues",
"members_url": "https://HOSTNAME/orgs/github/members{/member}",
"public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization",
"name": "github",
"company": "GitHub",
"blog": "https://github.com/blog",
"location": "San Francisco",
"email": "octocat@github.com",
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 2,
"public_gists": 1,
"followers": 20,
"following": 0,
"html_url": "https://github.com/octocat",
"created_at": "2008-01-14T04:33:35Z",
"updated_at": "2017-08-17T12:37:15Z",
"type": "Organization"
},
"ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}
Get a team by name
Gets a team using the team's slug
. To create the slug
, GitHub Enterprise Server replaces special characters in the name
string, changes all words to lowercase, and replaces spaces with a -
separator. For example, "My TEam Näme"
would become my-team-name
.
Note
You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}
.
Parâmetros para "Get a team by name"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
Códigos de status de resposta HTTP para "Get a team by name"
Código de status | Descrição |
---|---|
200 | OK |
404 | Resource not found |
Exemplos de código para "Get a team by name"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG
Response
Status: 200
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"members_count": 3,
"repos_count": 10,
"created_at": "2017-07-14T16:53:42Z",
"updated_at": "2017-08-17T12:37:15Z",
"organization": {
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://HOSTNAME/orgs/github",
"repos_url": "https://HOSTNAME/orgs/github/repos",
"events_url": "https://HOSTNAME/orgs/github/events",
"hooks_url": "https://HOSTNAME/orgs/github/hooks",
"issues_url": "https://HOSTNAME/orgs/github/issues",
"members_url": "https://HOSTNAME/orgs/github/members{/member}",
"public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization",
"name": "github",
"company": "GitHub",
"blog": "https://github.com/blog",
"location": "San Francisco",
"email": "octocat@github.com",
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 2,
"public_gists": 1,
"followers": 20,
"following": 0,
"html_url": "https://github.com/octocat",
"created_at": "2008-01-14T04:33:35Z",
"updated_at": "2017-08-17T12:37:15Z",
"type": "Organization"
},
"ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}
Update a team
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
Note
You can also specify a team by org_id
and team_id
using the route PATCH /organizations/{org_id}/team/{team_id}
.
Parâmetros para "Update a team"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
Nome, Tipo, Descrição |
---|
name string The name of the team. |
description string The description of the team. |
privacy string The level of privacy this team should have. Editing teams without specifying this parameter leaves
Pode ser um dos: |
notification_setting string The notification setting the team has chosen. Editing teams without specifying this parameter leaves
Pode ser um dos: |
permission string Closing down notice. The permission that new repositories will be added to the team with when none is specified. Padrão: Pode ser um dos: |
parent_team_id integer or null The ID of a team to set as the parent team. |
Códigos de status de resposta HTTP para "Update a team"
Código de status | Descrição |
---|---|
200 | Response when the updated information already exists |
201 | Created |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Update a team"
Exemplos de solicitação
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG \
-d '{"name":"new team name","description":"new team description","privacy":"closed","notification_setting":"notifications_enabled"}'
Response when the updated information already exists
Status: 200
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"members_count": 3,
"repos_count": 10,
"created_at": "2017-07-14T16:53:42Z",
"updated_at": "2017-08-17T12:37:15Z",
"organization": {
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://HOSTNAME/orgs/github",
"repos_url": "https://HOSTNAME/orgs/github/repos",
"events_url": "https://HOSTNAME/orgs/github/events",
"hooks_url": "https://HOSTNAME/orgs/github/hooks",
"issues_url": "https://HOSTNAME/orgs/github/issues",
"members_url": "https://HOSTNAME/orgs/github/members{/member}",
"public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization",
"name": "github",
"company": "GitHub",
"blog": "https://github.com/blog",
"location": "San Francisco",
"email": "octocat@github.com",
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 2,
"public_gists": 1,
"followers": 20,
"following": 0,
"html_url": "https://github.com/octocat",
"created_at": "2008-01-14T04:33:35Z",
"updated_at": "2017-08-17T12:37:15Z",
"type": "Organization"
},
"ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}
Delete a team
To delete a team, the authenticated user must be an organization owner or team maintainer.
If you are an organization owner, deleting a parent team will delete all of its child teams as well.
Note
You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}
.
Parâmetros para "Delete a team"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
Códigos de status de resposta HTTP para "Delete a team"
Código de status | Descrição |
---|---|
204 | No Content |
Exemplos de código para "Delete a team"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG
Response
Status: 204
List team projects
Lists the organization projects for a team.
Note
You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/projects
.
Parâmetros para "List team projects"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List team projects"
Código de status | Descrição |
---|---|
200 | OK |
Exemplos de código para "List team projects"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/projects
Response
Status: 200
[
{
"owner_url": "https://HOSTNAME/orgs/octocat",
"url": "https://HOSTNAME/projects/1002605",
"html_url": "https://github.com/orgs/api-playground/projects/1",
"columns_url": "https://HOSTNAME/projects/1002605/columns",
"id": 1002605,
"node_id": "MDc6UHJvamVjdDEwMDI2MDU=",
"name": "Organization Roadmap",
"body": "High-level roadmap for the upcoming year.",
"number": 1,
"state": "open",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2011-04-11T20:09:31Z",
"updated_at": "2014-03-04T18:58:10Z",
"organization_permission": "write",
"private": false,
"permissions": {
"read": true,
"write": true,
"admin": false
}
}
]
Check team permissions for a project
Checks whether a team has read
, write
, or admin
permissions for an organization project. The response includes projects inherited from a parent team.
Note
You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/projects/{project_id}
.
Parâmetros para "Check team permissions for a project"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
project_id integer ObrigatórioThe unique identifier of the project. |
Códigos de status de resposta HTTP para "Check team permissions for a project"
Código de status | Descrição |
---|---|
200 | OK |
404 | Not Found if project is not managed by this team |
Exemplos de código para "Check team permissions for a project"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/projects/PROJECT_ID
Response
Status: 200
{
"owner_url": "https://HOSTNAME/orgs/octocat",
"url": "https://HOSTNAME/projects/1002605",
"html_url": "https://github.com/orgs/api-playground/projects/1",
"columns_url": "https://HOSTNAME/projects/1002605/columns",
"id": 1002605,
"node_id": "MDc6UHJvamVjdDEwMDI2MDU=",
"name": "Organization Roadmap",
"body": "High-level roadmap for the upcoming year.",
"number": 1,
"state": "open",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2011-04-11T20:09:31Z",
"updated_at": "2014-03-04T18:58:10Z",
"organization_permission": "write",
"private": false,
"permissions": {
"read": true,
"write": true,
"admin": false
}
}
Add or update team project permissions
Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have admin
permissions for the project. The project and team must be part of the same organization.
Note
You can also specify a team by org_id
and team_id
using the route PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}
.
Parâmetros para "Add or update team project permissions"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
project_id integer ObrigatórioThe unique identifier of the project. |
Nome, Tipo, Descrição |
---|
permission string The permission to grant to the team for this project. Default: the team's Pode ser um dos: |
Códigos de status de resposta HTTP para "Add or update team project permissions"
Código de status | Descrição |
---|---|
204 | No Content |
403 | Forbidden if the project is not owned by the organization |
Exemplos de código para "Add or update team project permissions"
Exemplo de solicitação
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/projects/PROJECT_ID \
-d '{"permission":"write"}'
Response
Status: 204
Remove a project from a team
Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have read
access to both the team and project, or admin
access to the team or project. This endpoint removes the project from the team, but does not delete the project.
Note
You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}
.
Parâmetros para "Remove a project from a team"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
project_id integer ObrigatórioThe unique identifier of the project. |
Códigos de status de resposta HTTP para "Remove a project from a team"
Código de status | Descrição |
---|---|
204 | No Content |
Exemplos de código para "Remove a project from a team"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/projects/PROJECT_ID
Response
Status: 204
List team repositories
Lists a team's repositories visible to the authenticated user.
Note
You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/repos
.
Parâmetros para "List team repositories"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List team repositories"
Código de status | Descrição |
---|---|
200 | OK |
Exemplos de código para "List team repositories"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/repos
Response
Status: 200
[
{
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://HOSTNAME/repos/octocat/Hello-World",
"archive_url": "https://HOSTNAME/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://HOSTNAME/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://HOSTNAME/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://HOSTNAME/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://HOSTNAME/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://HOSTNAME/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://HOSTNAME/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://HOSTNAME/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://HOSTNAME/repos/octocat/Hello-World/contributors",
"deployments_url": "https://HOSTNAME/repos/octocat/Hello-World/deployments",
"downloads_url": "https://HOSTNAME/repos/octocat/Hello-World/downloads",
"events_url": "https://HOSTNAME/repos/octocat/Hello-World/events",
"forks_url": "https://HOSTNAME/repos/octocat/Hello-World/forks",
"git_commits_url": "https://HOSTNAME/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://HOSTNAME/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://HOSTNAME/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://HOSTNAME/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://HOSTNAME/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://HOSTNAME/repos/octocat/Hello-World/languages",
"merges_url": "https://HOSTNAME/repos/octocat/Hello-World/merges",
"milestones_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://HOSTNAME/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://HOSTNAME/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://HOSTNAME/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://HOSTNAME/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://HOSTNAME/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://HOSTNAME/repos/octocat/Hello-World/subscription",
"tags_url": "https://HOSTNAME/repos/octocat/Hello-World/tags",
"teams_url": "https://HOSTNAME/repos/octocat/Hello-World/teams",
"trees_url": "https://HOSTNAME/repos/octocat/Hello-World/git/trees{/sha}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"hooks_url": "https://HOSTNAME/repos/octocat/Hello-World/hooks",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"homepage": "https://github.com",
"language": null,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "master",
"open_issues_count": 0,
"is_template": false,
"topics": [
"octocat",
"atom",
"electron",
"api"
],
"has_issues": true,
"has_projects": true,
"has_wiki": true,
"has_pages": false,
"has_downloads": true,
"has_discussions": false,
"archived": false,
"disabled": false,
"visibility": "public",
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"security_and_analysis": {
"advanced_security": {
"status": "enabled"
},
"secret_scanning": {
"status": "enabled"
},
"secret_scanning_push_protection": {
"status": "disabled"
},
"secret_scanning_non_provider_patterns": {
"status": "disabled"
}
}
}
]
Check team permissions for a repository
Checks whether a team has admin
, push
, maintain
, triage
, or pull
permission for a repository. Repositories inherited through a parent team will also be checked.
You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom media type via the application/vnd.github.v3.repository+json
accept header.
If a team doesn't have permission for the repository, you will receive a 404 Not Found
response status.
If the repository is private, you must have at least read
permission for that repository, and your token must have the repo
or admin:org
scope. Otherwise, you will receive a 404 Not Found
response status.
Note
You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}
.
Parâmetros para "Check team permissions for a repository"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
Códigos de status de resposta HTTP para "Check team permissions for a repository"
Código de status | Descrição |
---|---|
200 | Alternative response with repository permissions |
204 | Response if team has permission for the repository. This is the response when the repository media type hasn't been provded in the Accept header. |
404 | Not Found if team does not have permission for the repository |
Exemplos de código para "Check team permissions for a repository"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/repos/OWNER/REPO
Alternative response with repository permissions
Status: 200
{
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://HOSTNAME/repos/octocat/Hello-World",
"archive_url": "https://HOSTNAME/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://HOSTNAME/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://HOSTNAME/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://HOSTNAME/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://HOSTNAME/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://HOSTNAME/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://HOSTNAME/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://HOSTNAME/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://HOSTNAME/repos/octocat/Hello-World/contributors",
"deployments_url": "https://HOSTNAME/repos/octocat/Hello-World/deployments",
"downloads_url": "https://HOSTNAME/repos/octocat/Hello-World/downloads",
"events_url": "https://HOSTNAME/repos/octocat/Hello-World/events",
"forks_url": "https://HOSTNAME/repos/octocat/Hello-World/forks",
"git_commits_url": "https://HOSTNAME/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://HOSTNAME/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://HOSTNAME/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://HOSTNAME/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://HOSTNAME/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://HOSTNAME/repos/octocat/Hello-World/languages",
"merges_url": "https://HOSTNAME/repos/octocat/Hello-World/merges",
"milestones_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://HOSTNAME/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://HOSTNAME/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://HOSTNAME/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://HOSTNAME/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://HOSTNAME/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://HOSTNAME/repos/octocat/Hello-World/subscription",
"tags_url": "https://HOSTNAME/repos/octocat/Hello-World/tags",
"teams_url": "https://HOSTNAME/repos/octocat/Hello-World/teams",
"trees_url": "https://HOSTNAME/repos/octocat/Hello-World/git/trees{/sha}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"hooks_url": "https://HOSTNAME/repos/octocat/Hello-World/hooks",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"homepage": "https://github.com",
"language": null,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "master",
"open_issues_count": 0,
"is_template": false,
"topics": [
"octocat",
"atom",
"electron",
"api"
],
"has_issues": true,
"has_projects": true,
"has_wiki": true,
"has_pages": false,
"has_downloads": true,
"archived": false,
"disabled": false,
"visibility": "public",
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {
"admin": false,
"maintain": false,
"push": false,
"triage": false,
"pull": true
},
"role_name": "read",
"allow_rebase_merge": true,
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
"allow_squash_merge": true,
"allow_auto_merge": false,
"delete_branch_on_merge": true,
"allow_merge_commit": true,
"subscribers_count": 42,
"network_count": 0,
"license": {
"key": "mit",
"name": "MIT License",
"url": "https://HOSTNAME/licenses/mit",
"spdx_id": "MIT",
"node_id": "MDc6TGljZW5zZW1pdA==",
"html_url": "https://HOSTNAME/licenses/mit"
},
"forks": 1,
"open_issues": 1,
"watchers": 1
}
Add or update team repository permissions
To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a 422 Unprocessable Entity
status if you attempt to add a repository to a team that is not owned by the organization. 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 method."
Note
You can also specify a team by org_id
and team_id
using the route PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}
.
For more information about the permission levels, see "Repository permission levels for an organization".
Parâmetros para "Add or update team repository permissions"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
Nome, Tipo, Descrição |
---|
permission string The permission to grant the team on this repository. We accept the following permissions to be set: |
Códigos de status de resposta HTTP para "Add or update team repository permissions"
Código de status | Descrição |
---|---|
204 | No Content |
Exemplos de código para "Add or update team repository permissions"
Exemplo de solicitação
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/repos/OWNER/REPO \
-d '{"permission":"push"}'
Response
Status: 204
Remove a repository from a team
If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team.
Note
You can also specify a team by org_id
and team_id
using the route DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}
.
Parâmetros para "Remove a repository from a team"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
Códigos de status de resposta HTTP para "Remove a repository from a team"
Código de status | Descrição |
---|---|
204 | No Content |
Exemplos de código para "Remove a repository from a team"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/repos/OWNER/REPO
Response
Status: 204
List child teams
Lists the child teams of the team specified by {team_slug}
.
Note
You can also specify a team by org_id
and team_id
using the route GET /organizations/{org_id}/team/{team_id}/teams
.
Parâmetros para "List child teams"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
org string ObrigatórioThe organization name. The name is not case sensitive. |
team_slug string ObrigatórioThe slug of the team name. |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List child teams"
Código de status | Descrição |
---|---|
200 | if child teams exist |
Exemplos de código para "List child teams"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/orgs/ORG/teams/TEAM_SLUG/teams
if child teams exist
Status: 200
[
{
"id": 2,
"node_id": "MDQ6VGVhbTI=",
"url": "https://HOSTNAME/teams/2",
"name": "Original Roster",
"slug": "original-roster",
"description": "Started it all.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/2/members{/member}",
"repositories_url": "https://HOSTNAME/teams/2/repos",
"parent": {
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos"
},
"html_url": "https://github.com/orgs/rails/teams/core"
}
]
Get a team (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the Get a team by name endpoint.
Parâmetros para "Get a team (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
Códigos de status de resposta HTTP para "Get a team (Legacy)"
Código de status | Descrição |
---|---|
200 | OK |
404 | Resource not found |
Exemplos de código para "Get a team (Legacy)"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID
Response
Status: 200
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"members_count": 3,
"repos_count": 10,
"created_at": "2017-07-14T16:53:42Z",
"updated_at": "2017-08-17T12:37:15Z",
"organization": {
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://HOSTNAME/orgs/github",
"repos_url": "https://HOSTNAME/orgs/github/repos",
"events_url": "https://HOSTNAME/orgs/github/events",
"hooks_url": "https://HOSTNAME/orgs/github/hooks",
"issues_url": "https://HOSTNAME/orgs/github/issues",
"members_url": "https://HOSTNAME/orgs/github/members{/member}",
"public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization",
"name": "github",
"company": "GitHub",
"blog": "https://github.com/blog",
"location": "San Francisco",
"email": "octocat@github.com",
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 2,
"public_gists": 1,
"followers": 20,
"following": 0,
"html_url": "https://github.com/octocat",
"created_at": "2008-01-14T04:33:35Z",
"updated_at": "2017-08-17T12:37:15Z",
"type": "Organization"
},
"ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}
Update a team (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Update a team endpoint.
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
Note
With nested teams, the privacy
for parent teams cannot be secret
.
Parâmetros para "Update a team (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
Nome, Tipo, Descrição |
---|
name string ObrigatórioThe name of the team. |
description string The description of the team. |
privacy string The level of privacy this team should have. Editing teams without specifying this parameter leaves
Pode ser um dos: |
notification_setting string The notification setting the team has chosen. Editing teams without specifying this parameter leaves
Pode ser um dos: |
permission string Closing down notice. The permission that new repositories will be added to the team with when none is specified. Padrão: Pode ser um dos: |
parent_team_id integer or null The ID of a team to set as the parent team. |
Códigos de status de resposta HTTP para "Update a team (Legacy)"
Código de status | Descrição |
---|---|
200 | Response when the updated information already exists |
201 | Created |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Update a team (Legacy)"
Exemplos de solicitação
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID \
-d '{"name":"new team name","description":"new team description","privacy":"closed","notification_setting":"notifications_enabled"}'
Response when the updated information already exists
Status: 200
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"members_count": 3,
"repos_count": 10,
"created_at": "2017-07-14T16:53:42Z",
"updated_at": "2017-08-17T12:37:15Z",
"organization": {
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://HOSTNAME/orgs/github",
"repos_url": "https://HOSTNAME/orgs/github/repos",
"events_url": "https://HOSTNAME/orgs/github/events",
"hooks_url": "https://HOSTNAME/orgs/github/hooks",
"issues_url": "https://HOSTNAME/orgs/github/issues",
"members_url": "https://HOSTNAME/orgs/github/members{/member}",
"public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization",
"name": "github",
"company": "GitHub",
"blog": "https://github.com/blog",
"location": "San Francisco",
"email": "octocat@github.com",
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 2,
"public_gists": 1,
"followers": 20,
"following": 0,
"html_url": "https://github.com/octocat",
"created_at": "2008-01-14T04:33:35Z",
"updated_at": "2017-08-17T12:37:15Z",
"type": "Organization"
},
"ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}
Delete a team (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a team endpoint.
To delete a team, the authenticated user must be an organization owner or team maintainer.
If you are an organization owner, deleting a parent team will delete all of its child teams as well.
Parâmetros para "Delete a team (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
Códigos de status de resposta HTTP para "Delete a team (Legacy)"
Código de status | Descrição |
---|---|
204 | No Content |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Delete a team (Legacy)"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID
Response
Status: 204
List team projects (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new List team projects
endpoint.
Lists the organization projects for a team.
Parâmetros para "List team projects (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List team projects (Legacy)"
Código de status | Descrição |
---|---|
200 | OK |
404 | Resource not found |
Exemplos de código para "List team projects (Legacy)"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/projects
Response
Status: 200
[
{
"owner_url": "https://HOSTNAME/orgs/octocat",
"url": "https://HOSTNAME/projects/1002605",
"html_url": "https://github.com/orgs/api-playground/projects/1",
"columns_url": "https://HOSTNAME/projects/1002605/columns",
"id": 1002605,
"node_id": "MDc6UHJvamVjdDEwMDI2MDU=",
"name": "Organization Roadmap",
"body": "High-level roadmap for the upcoming year.",
"number": 1,
"state": "open",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2011-04-11T20:09:31Z",
"updated_at": "2014-03-04T18:58:10Z",
"organization_permission": "write",
"private": false,
"permissions": {
"read": true,
"write": true,
"admin": false
}
}
]
Check team permissions for a project (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Check team permissions for a project endpoint.
Checks whether a team has read
, write
, or admin
permissions for an organization project. The response includes projects inherited from a parent team.
Parâmetros para "Check team permissions for a project (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
project_id integer ObrigatórioThe unique identifier of the project. |
Códigos de status de resposta HTTP para "Check team permissions for a project (Legacy)"
Código de status | Descrição |
---|---|
200 | OK |
404 | Not Found if project is not managed by this team |
Exemplos de código para "Check team permissions for a project (Legacy)"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/projects/PROJECT_ID
Response
Status: 200
{
"owner_url": "https://HOSTNAME/orgs/octocat",
"url": "https://HOSTNAME/projects/1002605",
"html_url": "https://github.com/orgs/api-playground/projects/1",
"columns_url": "https://HOSTNAME/projects/1002605/columns",
"id": 1002605,
"node_id": "MDc6UHJvamVjdDEwMDI2MDU=",
"name": "Organization Roadmap",
"body": "High-level roadmap for the upcoming year.",
"number": 1,
"state": "open",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2011-04-11T20:09:31Z",
"updated_at": "2014-03-04T18:58:10Z",
"organization_permission": "write",
"private": false,
"permissions": {
"read": true,
"write": true,
"admin": false
}
}
Add or update team project permissions (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Add or update team project permissions endpoint.
Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have admin
permissions for the project. The project and team must be part of the same organization.
Parâmetros para "Add or update team project permissions (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
project_id integer ObrigatórioThe unique identifier of the project. |
Nome, Tipo, Descrição |
---|
permission string The permission to grant to the team for this project. Default: the team's Pode ser um dos: |
Códigos de status de resposta HTTP para "Add or update team project permissions (Legacy)"
Código de status | Descrição |
---|---|
204 | No Content |
403 | Forbidden if the project is not owned by the organization |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Add or update team project permissions (Legacy)"
Exemplo de solicitação
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/projects/PROJECT_ID \
-d '{"permission":"read"}'
Response
Status: 204
Remove a project from a team (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove a project from a team endpoint.
Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have read
access to both the team and project, or admin
access to the team or project. Note: This endpoint removes the project from the team, but does not delete it.
Parâmetros para "Remove a project from a team (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
project_id integer ObrigatórioThe unique identifier of the project. |
Códigos de status de resposta HTTP para "Remove a project from a team (Legacy)"
Código de status | Descrição |
---|---|
204 | No Content |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Remove a project from a team (Legacy)"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/projects/PROJECT_ID
Response
Status: 204
List team repositories (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new List team repositories endpoint.
Parâmetros para "List team repositories (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List team repositories (Legacy)"
Código de status | Descrição |
---|---|
200 | OK |
404 | Resource not found |
Exemplos de código para "List team repositories (Legacy)"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/repos
Response
Status: 200
[
{
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://HOSTNAME/repos/octocat/Hello-World",
"archive_url": "https://HOSTNAME/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://HOSTNAME/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://HOSTNAME/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://HOSTNAME/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://HOSTNAME/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://HOSTNAME/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://HOSTNAME/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://HOSTNAME/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://HOSTNAME/repos/octocat/Hello-World/contributors",
"deployments_url": "https://HOSTNAME/repos/octocat/Hello-World/deployments",
"downloads_url": "https://HOSTNAME/repos/octocat/Hello-World/downloads",
"events_url": "https://HOSTNAME/repos/octocat/Hello-World/events",
"forks_url": "https://HOSTNAME/repos/octocat/Hello-World/forks",
"git_commits_url": "https://HOSTNAME/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://HOSTNAME/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://HOSTNAME/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://HOSTNAME/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://HOSTNAME/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://HOSTNAME/repos/octocat/Hello-World/languages",
"merges_url": "https://HOSTNAME/repos/octocat/Hello-World/merges",
"milestones_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://HOSTNAME/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://HOSTNAME/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://HOSTNAME/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://HOSTNAME/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://HOSTNAME/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://HOSTNAME/repos/octocat/Hello-World/subscription",
"tags_url": "https://HOSTNAME/repos/octocat/Hello-World/tags",
"teams_url": "https://HOSTNAME/repos/octocat/Hello-World/teams",
"trees_url": "https://HOSTNAME/repos/octocat/Hello-World/git/trees{/sha}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"hooks_url": "https://HOSTNAME/repos/octocat/Hello-World/hooks",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"homepage": "https://github.com",
"language": null,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "master",
"open_issues_count": 0,
"is_template": false,
"topics": [
"octocat",
"atom",
"electron",
"api"
],
"has_issues": true,
"has_projects": true,
"has_wiki": true,
"has_pages": false,
"has_downloads": true,
"has_discussions": false,
"archived": false,
"disabled": false,
"visibility": "public",
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"security_and_analysis": {
"advanced_security": {
"status": "enabled"
},
"secret_scanning": {
"status": "enabled"
},
"secret_scanning_push_protection": {
"status": "disabled"
},
"secret_scanning_non_provider_patterns": {
"status": "disabled"
}
}
}
]
Check team permissions for a repository (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Check team permissions for a repository endpoint.
Note
Repositories inherited through a parent team will also be checked.
You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom media type via the Accept
header:
Parâmetros para "Check team permissions for a repository (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
Códigos de status de resposta HTTP para "Check team permissions for a repository (Legacy)"
Código de status | Descrição |
---|---|
200 | Alternative response with extra repository information |
204 | Response if repository is managed by this team |
404 | Not Found if repository is not managed by this team |
Exemplos de código para "Check team permissions for a repository (Legacy)"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/repos/OWNER/REPO
Alternative response with extra repository information
Status: 200
{
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://HOSTNAME/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://HOSTNAME/users/octocat/followers",
"following_url": "https://HOSTNAME/users/octocat/following{/other_user}",
"gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}",
"starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions",
"organizations_url": "https://HOSTNAME/users/octocat/orgs",
"repos_url": "https://HOSTNAME/users/octocat/repos",
"events_url": "https://HOSTNAME/users/octocat/events{/privacy}",
"received_events_url": "https://HOSTNAME/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://HOSTNAME/repos/octocat/Hello-World",
"archive_url": "https://HOSTNAME/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://HOSTNAME/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://HOSTNAME/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://HOSTNAME/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://HOSTNAME/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://HOSTNAME/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://HOSTNAME/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://HOSTNAME/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://HOSTNAME/repos/octocat/Hello-World/contributors",
"deployments_url": "https://HOSTNAME/repos/octocat/Hello-World/deployments",
"downloads_url": "https://HOSTNAME/repos/octocat/Hello-World/downloads",
"events_url": "https://HOSTNAME/repos/octocat/Hello-World/events",
"forks_url": "https://HOSTNAME/repos/octocat/Hello-World/forks",
"git_commits_url": "https://HOSTNAME/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://HOSTNAME/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://HOSTNAME/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://HOSTNAME/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://HOSTNAME/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://HOSTNAME/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://HOSTNAME/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://HOSTNAME/repos/octocat/Hello-World/languages",
"merges_url": "https://HOSTNAME/repos/octocat/Hello-World/merges",
"milestones_url": "https://HOSTNAME/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://HOSTNAME/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://HOSTNAME/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://HOSTNAME/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://HOSTNAME/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://HOSTNAME/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://HOSTNAME/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://HOSTNAME/repos/octocat/Hello-World/subscription",
"tags_url": "https://HOSTNAME/repos/octocat/Hello-World/tags",
"teams_url": "https://HOSTNAME/repos/octocat/Hello-World/teams",
"trees_url": "https://HOSTNAME/repos/octocat/Hello-World/git/trees{/sha}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"hooks_url": "https://HOSTNAME/repos/octocat/Hello-World/hooks",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"homepage": "https://github.com",
"language": null,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "master",
"open_issues_count": 0,
"is_template": false,
"topics": [
"octocat",
"atom",
"electron",
"api"
],
"has_issues": true,
"has_projects": true,
"has_wiki": true,
"has_pages": false,
"has_downloads": true,
"archived": false,
"disabled": false,
"visibility": "public",
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {
"admin": false,
"maintain": false,
"push": false,
"triage": false,
"pull": true
},
"role_name": "read",
"allow_rebase_merge": true,
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
"allow_squash_merge": true,
"allow_auto_merge": false,
"delete_branch_on_merge": true,
"allow_merge_commit": true,
"subscribers_count": 42,
"network_count": 0,
"license": {
"key": "mit",
"name": "MIT License",
"url": "https://HOSTNAME/licenses/mit",
"spdx_id": "MIT",
"node_id": "MDc6TGljZW5zZW1pdA==",
"html_url": "https://HOSTNAME/licenses/mit"
},
"forks": 1,
"open_issues": 1,
"watchers": 1
}
Add or update team repository permissions (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new "Add or update team repository permissions" endpoint.
To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a 422 Unprocessable Entity
status if you attempt to add a repository to a team that is not owned by the organization.
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 method."
Parâmetros para "Add or update team repository permissions (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
Nome, Tipo, Descrição |
---|
permission string The permission to grant the team on this repository. If no permission is specified, the team's Pode ser um dos: |
Códigos de status de resposta HTTP para "Add or update team repository permissions (Legacy)"
Código de status | Descrição |
---|---|
204 | No Content |
403 | Forbidden |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "Add or update team repository permissions (Legacy)"
Exemplo de solicitação
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/repos/OWNER/REPO \
-d '{"permission":"push"}'
Response
Status: 204
Remove a repository from a team (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Remove a repository from a team endpoint.
If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team.
Parâmetros para "Remove a repository from a team (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
Códigos de status de resposta HTTP para "Remove a repository from a team (Legacy)"
Código de status | Descrição |
---|---|
204 | No Content |
Exemplos de código para "Remove a repository from a team (Legacy)"
Exemplo de solicitação
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/repos/OWNER/REPO
Response
Status: 204
List child teams (Legacy)
Warning
Endpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new List child teams
endpoint.
Parâmetros para "List child teams (Legacy)"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
team_id integer ObrigatórioThe unique identifier of the team. |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List child teams (Legacy)"
Código de status | Descrição |
---|---|
200 | if child teams exist |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemplos de código para "List child teams (Legacy)"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/teams/TEAM_ID/teams
if child teams exist
Status: 200
[
{
"id": 2,
"node_id": "MDQ6VGVhbTI=",
"url": "https://HOSTNAME/teams/2",
"name": "Original Roster",
"slug": "original-roster",
"description": "Started it all.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/2/members{/member}",
"repositories_url": "https://HOSTNAME/teams/2/repos",
"parent": {
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"notification_setting": "notifications_enabled",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos"
},
"html_url": "https://github.com/orgs/rails/teams/core"
}
]
List teams for the authenticated user
List all of the teams across all of the organizations to which the authenticated user belongs.
OAuth app tokens and personal access tokens (classic) need the user
, repo
, or read:org
scope to use this endpoint.
When using a fine-grained personal access token, the resource owner of the token must be a single organization, and the response will only include the teams from that organization.
Tokens de acesso refinados para "List teams for the authenticated user"
Esse ponto de extremidade funciona com os seguintes tipos de token refinados:
O token refinaado não requer permissões.
Parâmetros para "List teams for the authenticated user"
Nome, Tipo, Descrição |
---|
accept string Setting to |
Nome, Tipo, Descrição |
---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Padrão: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Padrão: |
Códigos de status de resposta HTTP para "List teams for the authenticated user"
Código de status | Descrição |
---|---|
200 | OK |
304 | Not modified |
403 | Forbidden |
404 | Resource not found |
Exemplos de código para "List teams for the authenticated user"
Exemplo de solicitação
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/user/teams
Response
Status: 200
[
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://HOSTNAME/teams/1",
"html_url": "https://github.com/orgs/github/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"permission": "admin",
"members_url": "https://HOSTNAME/teams/1/members{/member}",
"repositories_url": "https://HOSTNAME/teams/1/repos",
"parent": null,
"members_count": 3,
"repos_count": 10,
"created_at": "2017-07-14T16:53:42Z",
"updated_at": "2017-08-17T12:37:15Z",
"organization": {
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://HOSTNAME/orgs/github",
"repos_url": "https://HOSTNAME/orgs/github/repos",
"events_url": "https://HOSTNAME/orgs/github/events",
"hooks_url": "https://HOSTNAME/orgs/github/hooks",
"issues_url": "https://HOSTNAME/orgs/github/issues",
"members_url": "https://HOSTNAME/orgs/github/members{/member}",
"public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization",
"name": "github",
"company": "GitHub",
"blog": "https://github.com/blog",
"location": "San Francisco",
"email": "octocat@github.com",
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 2,
"public_gists": 1,
"followers": 20,
"following": 0,
"html_url": "https://github.com/octocat",
"created_at": "2008-01-14T04:33:35Z",
"type": "Organization"
},
"ldap_dn": "uid=asdf,ou=users,dc=github,dc=com"
}
]