doc-locale/fr-fr/api/custom_attributes.md
{{< details >}}
{{< /details >}}
Utilisez cette API pour gérer les attributs personnalisés des utilisateurs, des groupes et des projets.
Prérequis :
Liste tous les attributs personnalisés pour une ressource spécifiée.
GET /users/:id/custom_attributes
GET /groups/:id/custom_attributes
GET /projects/:id/custom_attributes
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | integer | oui | L'identifiant d'une ressource |
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/users/42/custom_attributes"
Exemple de réponse :
[
{
"key": "location",
"value": "Antarctica"
},
{
"key": "role",
"value": "Developer"
}
]
Récupère un attribut personnalisé spécifié pour une ressource.
GET /users/:id/custom_attributes/:key
GET /groups/:id/custom_attributes/:key
GET /projects/:id/custom_attributes/:key
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | integer | oui | L'identifiant d'une ressource |
key | string | oui | La clé de l'attribut personnalisé |
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/users/42/custom_attributes/location"
Exemple de réponse :
{
"key": "location",
"value": "Antarctica"
}
Met à jour ou crée un attribut personnalisé pour une ressource spécifiée. L'attribut est mis à jour s'il existe déjà, ou nouvellement créé dans le cas contraire.
PUT /users/:id/custom_attributes/:key
PUT /groups/:id/custom_attributes/:key
PUT /projects/:id/custom_attributes/:key
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | integer | oui | L'identifiant d'une ressource |
key | string | oui | La clé de l'attribut personnalisé |
value | string | oui | La valeur de l'attribut personnalisé |
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--data "value=Greenland" \
--url "https://gitlab.example.com/api/v4/users/42/custom_attributes/location"
Exemple de réponse :
{
"key": "location",
"value": "Greenland"
}
Supprime un attribut personnalisé spécifié pour une ressource.
DELETE /users/:id/custom_attributes/:key
DELETE /groups/:id/custom_attributes/:key
DELETE /projects/:id/custom_attributes/:key
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | integer | oui | L'identifiant d'une ressource |
key | string | oui | La clé de l'attribut personnalisé |
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/users/42/custom_attributes/location"