네임스페이스 API
사용자 이름과 그룹 이름은 네임스페이스라는 특별한 카테고리에 속합니다.
다음 문서도 참조할 수 있습니다:
페이징이 사용됩니다.
네임스페이스 목록
top_level_only
는 GitLab 16.8에 도입되었습니다.
인증된 사용자의 네임스페이스 목록을 가져옵니다. 사용자가 관리자일 경우, GitLab 인스턴스의 모든 네임스페이스 목록이 표시됩니다.
GET /namespaces
GET /namespaces?search=foobar
GET /namespaces?owned_only=true
GET /namespaces?top_level_only=true
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
search |
문자열 | 아니오 | 검색 기준에 따라 사용자가 볼 수 있는 네임스페이스 목록을 반환합니다. |
owned_only |
불리언 | 아니오 | 소유한 네임스페이스 목록만 반환합니다. |
top_level_only |
불리언 | 아니오 | GitLab 16.8 이상에서 최상위 네임스페이스 목록만 반환합니다. |
예제 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/namespaces"
예제 응답:
[
{
"id": 1,
"name": "user1",
"path": "user1",
"kind": "user",
"full_path": "user1",
"parent_id": null,
"avatar_url": "https://secure.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "https://gitlab.example.com/user1",
"billable_members_count": 1,
"plan": "default",
"end_date": null,
"trial_ends_on": null,
"trial": false,
"root_repository_size": 100,
"projects_count": 3
},
{
"id": 2,
"name": "group1",
"path": "group1",
"kind": "group",
"full_path": "group1",
"parent_id": null,
"avatar_url": null,
"web_url": "https://gitlab.example.com/groups/group1",
"members_count_with_descendants": 2,
"billable_members_count": 2,
"plan": "default",
"end_date": null,
"trial_ends_on": null,
"trial": false,
"root_repository_size": 100,
"projects_count": 3
},
{
"id": 3,
"name": "bar",
"path": "bar",
"kind": "group",
"full_path": "foo/bar",
"parent_id": 9,
"avatar_url": null,
"web_url": "https://gitlab.example.com/groups/foo/bar",
"members_count_with_descendants": 5,
"billable_members_count": 5,
"plan": "default",
"end_date": null,
"trial_ends_on": null,
"trial": false,
"root_repository_size": 100,
"projects_count": 3
}
"projects_count": 3
]
소유자는 네임스페이스와 관련된 plan
속성도 볼 수 있습니다:
[
{
"id": 1,
"name": "user1",
"plan": "silver",
...
}
]
GitLab.com의 사용자는 max_seats_used
, seats_in_use
및 max_seats_used_changed_at
매개변수도 볼 수 있습니다.
max_seats_used
는 그룹이 가졌던 최고 사용자 수입니다.
seats_in_use
는 현재 사용 중인 라이센스 좌석 수입니다.
max_seats_used_changed_at
는 max_seats_used
값이 변경된 날짜를 표시합니다. 모든 값은 하루에 한 번 업데이트됩니다.
max_seats_used
와 seats_in_use
는 유료 플랜의 네임스페이스에 대해서만 0이 아닙니다.
[
{
"id": 1,
"name": "user1",
"billable_members_count": 2,
"max_seats_used": 3,
"max_seats_used_changed_at":"2023-02-13T12:00:02.000Z",
"seats_in_use": 2,
...
}
]
members_count_with_descendants
, root_repository_size
, projects_count
및 plan
을 볼 수 있습니다.ID로 네임스페이스 가져오기
ID로 네임스페이스를 가져옵니다.
GET /namespaces/:id
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 네임스페이스의 ID 또는 URL 인코딩된 경로 |
예시 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/namespaces/2"
예시 응답:
{
"id": 2,
"name": "group1",
"path": "group1",
"kind": "group",
"full_path": "group1",
"parent_id": null,
"avatar_url": null,
"web_url": "https://gitlab.example.com/groups/group1",
"members_count_with_descendants": 2,
"billable_members_count": 2,
"max_seats_used": 0,
"seats_in_use": 0,
"plan": "default",
"end_date": null,
"trial_ends_on": null,
"trial": false,
"root_repository_size": 100,
"projects_count": 3
}
예시 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/namespaces/group1"
예시 응답:
{
"id": 2,
"name": "group1",
"path": "group1",
"kind": "group",
"full_path": "group1",
"parent_id": null,
"avatar_url": null,
"web_url": "https://gitlab.example.com/groups/group1",
"members_count_with_descendants": 2,
"billable_members_count": 2,
"max_seats_used": 0,
"seats_in_use": 0,
"plan": "default",
"end_date": null,
"trial_ends_on": null,
"trial": false,
"root_repository_size": 100
}
네임스페이스 존재 여부 확인
경로로 네임스페이스의 존재 여부를 확인합니다. 이미 존재하지 않는 새로운 네임스페이스 경로를 제안합니다.
GET /namespaces/:namespace/exists
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
namespace |
문자열 | 예 | 네임스페이스의 경로. |
parent_id |
정수 | 아니오 | 상위 네임스페이스의 ID. ID가 지정되지 않으면 최상위 네임스페이스만 고려됩니다. |
예시 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/namespaces/my-group/exists?parent_id=1"
예시 응답:
{
"exists": true,
"suggests": [
"my-group1"
]
}