Skip to main content

Esta versão do GitHub Enterprise foi descontinuada em 2022-06-03. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, melhorar a segurança e novos recursos, upgrade to the latest version of GitHub Enterprise. Para ajuda com a atualização, contact GitHub Enterprise support.

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

LDAP

Você pode usar a API LDAP para atualizar as relações de conta entre um usuário ou equipe GitHub Enterprise Server e sua entrada LDAP vinculada ou enfileirar uma nova sincronização.

Com os endpoints de mapeamento LDAP, você é capaz de atualizar o Nome Distinto (DN) para o qual um usuário ou uma equipe mapeia. Note que os endpoints LDAP são geralmente eficazes apenas se o seu aplicativo de GitHub Enterprise Server tiver Sincronização LDAP habilitada. O endpoint mapeamento LDAP de atualização para um usuário pode ser usado quando o LDAP é habilitado, mesmo que a sincronização LDAP esteja desativada.

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.

If you pass the hellcat-preview media type, you can also update the LDAP mapping of a child team.

Parâmetros

Headers
Nome, Tipo, Descrição
acceptstring

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

Ver aviso de pré-visualização
Path parameters
Nome, Tipo, Descrição
team_idintegerObrigatório

The unique identifier of the team.

Body parameters
Nome, Tipo, Descrição
ldap_dnstringObrigatório

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

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

patch/admin/ldap/teams/{team_id}/mapping
curl \ -X PATCH \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ 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://api.github.com/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://api.github.com/teams/1/members{/member}", "repositories_url": "https://api.github.com/teams/1/repos", "parent": null }

Aviso de pré-visualização

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

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

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
team_idintegerObrigatório

The unique identifier of the team.

HTTP response status codes

Status codeDescrição
201

Created

Amostras de código

post/admin/ldap/teams/{team_id}/sync
curl \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/ldap/teams/TEAM_ID/sync

Response

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

Update LDAP mapping for a user

Parâmetros

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
usernamestringObrigatório

The handle for the GitHub user account.

Body parameters
Nome, Tipo, Descrição
ldap_dnstringObrigatório

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

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

patch/admin/ldap/users/{username}/mapping
curl \ -X PATCH \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ 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://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/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

Headers
Nome, Tipo, Descrição
acceptstring

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

Path parameters
Nome, Tipo, Descrição
usernamestringObrigatório

The handle for the GitHub user account.

HTTP response status codes

Status codeDescrição
201

Created

Amostras de código

post/admin/ldap/users/{username}/sync
curl \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/ldap/users/USERNAME/sync

Response

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