Une fois qu’un administrateur de site a mis à niveau votre instance Enterprise Server vers Enterprise Server 3.9 ou ultérieur, l’API REST est versionnée. Pour savoir comment trouver la version de votre instance, consultez « À propos des versions de GitHub Docs ». Pour plus d’informations, consultez « À propos des versions de l’API ».
Organisations
Utilisez l’API REST pour créer des organisations sur votre entreprise.
À propos de l’administration de l’organisation
Ces points de terminaison sont uniquement disponibles pour les administrateurs de site authentifiés. Les utilisateurs normaux recevront une réponse 404
.
Create an organization
Paramètres pour « Create an organization »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres du corps |
Nom, Type, Description |
login string ObligatoireThe organization's username. |
admin string ObligatoireThe login of the user who will manage this organization. |
profile_name string The organization's display name. |
Codes d’état de la réponse HTTP pour « Create an organization »
Code d’état | Description |
---|---|
201 | Created |
Exemples de code pour « Create an organization »
post/admin/organizations
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/organizations \
-d '{"login":"github","profile_name":"GitHub, Inc.","admin":"monalisaoctocat"}'
Response
Status: 201
{
"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"
}
Update an organization name
Paramètres pour « Update an organization name »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
Paramètres du corps |
Nom, Type, Description |
login string ObligatoireThe organization's new name. |
Codes d’état de la réponse HTTP pour « Update an organization name »
Code d’état | Description |
---|---|
202 | Accepted |
Exemples de code pour « Update an organization name »
patch /admin /organizations /{org}
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/organizations/ORG \
-d '{"login":"the-new-octocats"}'
Response
Status: 202
{
"message": "Job queued to rename organization. It may take a few minutes to complete.",
"url": "https://<hostname>/api/v3/organizations/1"
}