Back to Gitlabhq

API des organisations

doc-locale/fr-fr/api/organizations.md

19.3.02.4 KB
Original Source

{{< details >}}

  • Édition : Gratuite, GitLab Premium, GitLab Ultimate
  • Offre : GitLab.com, GitLab Self-Managed
  • Statut : Expérience

{{< /details >}}

Utilisez cette API pour interagir avec les organisations GitLab. Pour plus d'informations, consultez organization.

Créer une organisation {#create-an-organization}

{{< history >}}

  • Introduit dans GitLab 17.5 avec un feature flag nommé allow_organization_creation. Désactivé par défaut. Cette fonctionnalité est une expérimentation.
  • Modifié dans GitLab 18.4. Le feature flag allow_organization_creation a été consolidé et renommé en organization_switching.

{{< /history >}}

[!flag] La disponibilité de cette fonctionnalité est contrôlée par un feature flag. Pour plus d'informations, consultez l'historique.

Crée une organisation.

Ce point de terminaison est une expérience et peut être modifié ou supprimé sans préavis.

plaintext
POST /organizations

Paramètres :

AttributTypeObligatoireDescription
namestringouiLe nom de l'organisation
pathstringouiLe chemin de l'organisation
descriptionstringnonLa description de l'organisation
avatarfilenonL'image d'avatar de l'organisation

Exemple de requête :

shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--form "name=New Organization" \
--form "path=new-org" \
--form "description=A new organization" \
--form "avatar=@/path/to/avatar.png" \
"https://gitlab.example.com/api/v4/organizations"

Exemple de réponse :

json
{
  "id": 42,
  "name": "New Organization",
  "path": "new-org",
  "description": "A new organization",
  "created_at": "2024-09-18T02:35:15.371Z",
  "updated_at": "2024-09-18T02:35:15.371Z",
  "web_url": "https://gitlab.example.com/o/new-org/-/overview",
  "avatar_url": "https://gitlab.example.com/uploads/-/system/organizations/organization_detail/avatar/42/avatar.png"
}