Puntos de conexión de API REST para colaboradores externos
Usa la API de REST para administrar colaboradores externos.
List outside collaborators for an organization
List all users who are outside collaborators of an organization.
Tokens de acceso específicos para "List outside collaborators for an organization"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
- Tokens de acceso de usuario de la aplicación de GitHub
- Token de acceso a la instalación de la aplicación de GitHub
- Tokens de acceso personal específico
El token pormenorizado debe tener el siguiente conjunto de permisos:
- "Members" organization permissions (read)
Parámetros para "List outside collaborators for an organization"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
org string RequeridoThe organization name. The name is not case sensitive. |
Nombre, Tipo, Descripción |
---|
filter string Filter the list of outside collaborators. Valor predeterminado: Puede ser uno de los siguientes: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Valor predeterminado: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Valor predeterminado: |
Códigos de estado de respuesta HTTP para "List outside collaborators for an organization"
status code | Descripción |
---|---|
200 | OK |
Ejemplos de código para "List outside collaborators for an organization"
Ejemplo de solicitud
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/outside_collaborators
Response
Status: 200
[
{
"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
}
]
Convert an organization member to outside collaborator
When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "Converting an organization member to an outside collaborator". Converting an organization member to an outside collaborator may be restricted by enterprise administrators. For more information, see "Enforcing repository management policies in your enterprise."
Tokens de acceso específicos para "Convert an organization member to outside collaborator"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
- Tokens de acceso de usuario de la aplicación de GitHub
- Token de acceso a la instalación de la aplicación de GitHub
- Tokens de acceso personal específico
El token pormenorizado debe tener el siguiente conjunto de permisos:
- "Members" organization permissions (write)
Parámetros para "Convert an organization member to outside collaborator"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
org string RequeridoThe organization name. The name is not case sensitive. |
username string RequeridoThe handle for the GitHub user account. |
Nombre, Tipo, Descripción |
---|
async boolean When set to Valor predeterminado: |
Códigos de estado de respuesta HTTP para "Convert an organization member to outside collaborator"
status code | Descripción |
---|---|
202 | User is getting converted asynchronously |
204 | User was converted |
403 | Forbidden if user is the last owner of the organization, not a member of the organization, or if the enterprise enforces a policy for inviting outside collaborators. For more information, see "Enforcing repository management policies in your enterprise." |
404 | Resource not found |
Ejemplos de código para "Convert an organization member to outside collaborator"
Ejemplos de solicitud
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/outside_collaborators/USERNAME \
-d '{"async":true}'
User is getting converted asynchronously
Status: 202
Remove outside collaborator from an organization
Removing a user from this list will remove them from all the organization's repositories.
Tokens de acceso específicos para "Remove outside collaborator from an organization"
Este punto de conexión funciona con los siguientes tipos de token pormenorizados:
- Tokens de acceso de usuario de la aplicación de GitHub
- Token de acceso a la instalación de la aplicación de GitHub
- Tokens de acceso personal específico
El token pormenorizado debe tener el siguiente conjunto de permisos:
- "Members" organization permissions (write)
Parámetros para "Remove outside collaborator from an organization"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
org string RequeridoThe organization name. The name is not case sensitive. |
username string RequeridoThe handle for the GitHub user account. |
Códigos de estado de respuesta HTTP para "Remove outside collaborator from an organization"
status code | Descripción |
---|---|
204 | No Content |
422 | Unprocessable Entity if user is a member of the organization |
Ejemplos de código para "Remove outside collaborator from an organization"
Ejemplo de solicitud
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/outside_collaborators/USERNAME
Response
Status: 204