Custom Attributes 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
| 속성 | 타입 | 필수 | 설명 | 
|---|---|---|---|
id
 | 정수 | 예 | 리소스의 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
| 속성 | 타입 | 필수 | 설명 | 
|---|---|---|---|
id
 | 정수 | 예 | 리소스의 ID | 
key
 | 문자열 | 예 | 사용자 정의 속성의 키 | 
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
| 속성 | 타입 | 필수 | 설명 | 
|---|---|---|---|
id
 | 정수 | 예 | 리소스의 ID | 
key
 | 문자열 | 예 | 사용자 정의 속성의 키 | 
value
 | 문자열 | 예 | 사용자 정의 속성의 값 | 
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
| 속성 | 타입 | 필수 | 설명 | 
|---|---|---|---|
id
 | 정수 | 예 | 리소스의 ID | 
key
 | 문자열 | 예 | 사용자 정의 속성의 키 | 
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/42/custom_attributes/location"
도움말