Skip to main content
Nous publions des mises à jour fréquentes de notre documentation, et la traduction de cette page peut encore être en cours. Pour obtenir les informations les plus actuelles, consultez la documentation anglaise.

Nous avons récemment déplacé une partie de la documentation de l’API REST. Si vous ne trouvez pas ce que vous recherchez, vous pouvez essayer la page d’API REST Actions.

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 application/vnd.github+json is recommended.

Paramètres du corps
Nom, Type, Description
login string Obligatoire

The organization's username.

admin string Obligatoire

The 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’étatDescription
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 application/vnd.github+json is recommended.

Paramètres de chemin d’accès
Nom, Type, Description
org string Obligatoire

The organization name. The name is not case sensitive.

Paramètres du corps
Nom, Type, Description
login string Obligatoire

The organization's new name.

Codes d’état de la réponse HTTP pour « Update an organization name »

Code d’étatDescription
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" }