사용자 정의 속성 API

Tier: Free, Premium, Ultimate Offering: Self-managed, GitLab Dedicated

모든 사용자 정의 속성 API 호출은 관리자로 인증되어야 합니다.

현재 사용자 정의 속성은 사용자, 그룹 및 프로젝트에서 사용할 수 있으며, 이 문서에서는 이를 “자원”이라고 합니다.

사용자 정의 속성 목록

자원에 대한 모든 사용자 정의 속성을 가져옵니다.

GET /users/:id/custom_attributes  
GET /groups/:id/custom_attributes  
GET /projects/:id/custom_attributes  
Attribute Type Required Description
id integer yes 자원의 ID
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/42/custom_attributes"  

예시 응답:

[  
   {  
      "key": "location",  
      "value": "Antarctica"  
   },  
   {  
      "key": "role",  
      "value": "Developer"  
   }  
]  

단일 사용자 정의 속성

자원에 대한 단일 사용자 정의 속성을 가져옵니다.

GET /users/:id/custom_attributes/:key  
GET /groups/:id/custom_attributes/:key  
GET /projects/:id/custom_attributes/:key  
Attribute Type Required Description
id integer yes 자원의 ID
key string yes 사용자 정의 속성의 키
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/42/custom_attributes/location"  

예시 응답:

{  
   "key": "location",  
   "value": "Antarctica"  
}  

사용자 정의 속성 설정

자원에 사용자 정의 속성을 설정합니다. 속성이 이미 존재하는 경우 업데이트되며, 그렇지 않은 경우 새로 생성됩니다.

PUT /users/:id/custom_attributes/:key  
PUT /groups/:id/custom_attributes/:key  
PUT /projects/:id/custom_attributes/:key  
Attribute Type Required Description
id integer yes 자원의 ID
key string yes 사용자 정의 속성의 키
value string yes 사용자 정의 속성의 값
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \  
     --data "value=Greenland" "https://gitlab.example.com/api/v4/users/42/custom_attributes/location"  

예시 응답:

{  
   "key": "location",  
   "value": "Greenland"  
}  

사용자 정의 속성 삭제

자원에 대한 사용자 정의 속성을 삭제합니다.

DELETE /users/:id/custom_attributes/:key  
DELETE /groups/:id/custom_attributes/:key  
DELETE /projects/:id/custom_attributes/:key  
Attribute Type Required Description
id integer yes 자원의 ID
key string yes 사용자 정의 속성의 키
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/42/custom_attributes/location"