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
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"