名前空間API

ユーザー名とグループ名はネームスペースと呼ばれる特別なカテゴリーに属します。

ユーザーとグループがサポートするAPIコールについては、それぞれユーザーとグループのドキュメントを参照してください。

ページネーションを使用しています。

名前空間の一覧

認証されたユーザーの名前空間のリストを取得します。 ユーザーが管理者の場合は、GitLabインスタンス内のすべての名前空間のリストが表示されます。

GET /namespaces

リクエスト例

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"
  },
  {
    "id": 2,
    "name": "group1",
    "path": "group1",
    "kind": "group",
    "full_path": "group1",
    "parent_id": null,
    "members_count_with_descendants": 2
  },
  {
    "id": 3,
    "name": "bar",
    "path": "bar",
    "kind": "group",
    "full_path": "foo/bar",
    "parent_id": 9,
    "members_count_with_descendants": 5
  }
]

GitLab.comBronze 以降のユーザーは、名前空間に関連付けられているplan パラメータを見ることもできます:

[
  {
    "id": 1,
    "name": "user1",
    "plan": "bronze",
    ...
  }
]
注:グループのメンテナー/オーナーにのみ、members_count_with_descendantsplan と同様に表示されます。 .

名前空間の検索

名前またはパスの文字列に一致するすべての名前空間を取得します。

GET /namespaces?search=foobar
属性 タイプ 必須 説明
search いいえ 検索条件に基づいて、ユーザが閲覧する権限を持つ名前空間のリストを返します。

リクエスト例

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/namespaces?search=twitter"

回答例

[
  {
    "id": 4,
    "name": "twitter",
    "path": "twitter",
    "kind": "group",
    "full_path": "twitter",
    "parent_id": null,
    "members_count_with_descendants": 2
  }
]

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,
  "members_count_with_descendants": 2
}

リクエスト例

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,
  "members_count_with_descendants": 2
}