네임스페이스 API

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

사용자 이름과 그룹 이름은 네임스페이스라는 특별한 범주에 속합니다.

또한 다음 문서를 확인하고 싶을 수 있습니다:

Pagination이 사용됩니다.

네임스페이스 목록

인증된 사용자의 네임스페이스 목록을 가져옵니다. 사용자가 관리자인 경우 GitLab 인스턴스의 모든 네임스페이스 목록이 표시됩니다.

GET /namespaces
GET /namespaces?search=foobar
GET /namespaces?owned_only=true
GET /namespaces?top_level_only=true
속성 유형 필수 설명
search string 아니오 검색 기준에 따라 사용자가 볼 수 있는 네임스페이스 목록을 반환합니다
owned_only boolean 아니오 GitLab 14.2 이후, 소유한 네임스페이스 목록만 반환합니다
top_level_only boolean 아니오 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는 현재 사용 중인 라이선스 seat 수입니다. max_seats_used_changed_atmax_seats_used 값이 변경된 날짜를 보여줍니다. 이 모든 값은 매일 업데이트됩니다.

max_seats_usedseats_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_countplan을 볼 수 있습니다.

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