Skip to main content

Esta versão do GitHub Enterprise Server será descontinuada em 2024-06-29. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, segurança aprimorada e novos recursos, atualize para a última versão do GitHub Enterprise Server. Para obter ajuda com a atualização, entre em contato com o suporte do GitHub Enterprise.

O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade da API REST para LDAP

Use a API REST para atualizar as relações de conta entre um usuário ou equipe do GitHub Enterprise Server e a respectiva entrada LDAP vinculada ou enfileirar uma nova sincronização.

Sobre o LDAP

É possível usar esses pontos de extremidade para atualizar o DN (nome diferenciado) para o qual um usuário ou equipe é mapeado. Observe que, na maioria dos casos, é necessário ter a sincronização do LDAP habilitada para seu dispositivo GitHub Enterprise Server. O ponto de extremidade "Atualizar o mapeamento de LDAP para um usuário" pode ser usado quando o LDAP está habilitado, mesmo quando a sincronização do LDAP está desabilitada.

Update LDAP mapping for a team

Updates 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 Create a team endpoint to create a team with LDAP mapping.

Parâmetros para "Update LDAP mapping for a team"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
team_id integer Obrigatório

The unique identifier of the team.

Parâmetros do corpo
Nome, Tipo, Descrição
ldap_dn string Obrigatório

The distinguished name (DN) of the LDAP entry to map to a team.

Códigos de status de resposta HTTP para "Update LDAP mapping for a team"

Código de statusDescrição
200

OK

Exemplos de código para "Update LDAP mapping for a team"

Exemplo de solicitação

patch/admin/ldap/teams/{team_id}/mapping
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/admin/ldap/teams/TEAM_ID/mapping \ -d '{"ldap_dn":"cn=Enterprise Ops,ou=teams,dc=github,dc=com"}'

Response

Status: 200
{ "ldap_dn": "cn=Enterprise Ops,ou=teams,dc=github,dc=com", "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 }

Sync LDAP mapping for a team

Note that this API call does not automatically initiate an LDAP sync. Rather, if a 201 is returned, the sync job is queued successfully, and is performed when the instance is ready.

Parâmetros para "Sync LDAP mapping for a team"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
team_id integer Obrigatório

The unique identifier of the team.

Códigos de status de resposta HTTP para "Sync LDAP mapping for a team"

Código de statusDescrição
201

Created

Exemplos de código para "Sync LDAP mapping for a team"

Exemplo de solicitação

post/admin/ldap/teams/{team_id}/sync
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/admin/ldap/teams/TEAM_ID/sync

Response

Status: 201
{ "status": "queued" }

Update LDAP mapping for a user

Parâmetros para "Update LDAP mapping for a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

Parâmetros do corpo
Nome, Tipo, Descrição
ldap_dn string Obrigatório

The distinguished name (DN) of the LDAP entry to map to a team.

Códigos de status de resposta HTTP para "Update LDAP mapping for a user"

Código de statusDescrição
200

OK

Exemplos de código para "Update LDAP mapping for a user"

Exemplo de solicitação

patch/admin/ldap/users/{username}/mapping
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/admin/ldap/users/USERNAME/mapping \ -d '{"ldap_dn":"uid=asdf,ou=users,dc=github,dc=com"}'

Response

Status: 200
{ "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com", "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, "name": "monalisa octocat", "company": "GitHub", "blog": "https://github.com/blog", "location": "San Francisco", "email": "octocat@github.com", "hireable": false, "bio": "There once was...", "twitter_username": "monatheoctocat", "public_repos": 2, "public_gists": 1, "followers": 20, "following": 0, "created_at": "2008-01-14T04:33:35Z", "updated_at": "2008-01-14T04:33:35Z", "private_gists": 81, "total_private_repos": 100, "owned_private_repos": 100, "disk_usage": 10000, "collaborators": 8, "two_factor_authentication": true, "plan": { "name": "Medium", "space": 400, "private_repos": 20, "collaborators": 0 } }

Sync LDAP mapping for a user

Note that this API call does not automatically initiate an LDAP sync. Rather, if a 201 is returned, the sync job is queued successfully, and is performed when the instance is ready.

Parâmetros para "Sync LDAP mapping for a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

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

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

Códigos de status de resposta HTTP para "Sync LDAP mapping for a user"

Código de statusDescrição
201

Created

Exemplos de código para "Sync LDAP mapping for a user"

Exemplo de solicitação

post/admin/ldap/users/{username}/sync
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/admin/ldap/users/USERNAME/sync

Response

Status: 201
{ "status": "queued" }