BigW Consortium Gitlab

namespaces.md 1.4 KB
Newer Older
1 2
# Namespaces

3 4 5 6
Usernames and groupnames fall under a special category called namespaces.

For users and groups supported API calls see the [users](users.md) and
[groups](groups.md) documentation respectively.
7 8 9

[Pagination](README.md#pagination) is used.

10 11
## List namespaces

12 13
Get a list of the namespaces of the authenticated user. If the user is an
administrator, a list of all namespaces in the GitLab instance is shown.
14 15 16 17 18

```
GET /namespaces
```

19 20
Example request:

21
```bash
22
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/namespaces
23 24
```

25 26
Example response:

27 28 29 30 31 32 33 34 35 36 37
```json
[
  {
    "id": 1,
    "path": "user1",
    "kind": "user"
  },
  {
    "id": 2,
    "path": "group1",
    "kind": "group"
38 39 40 41 42 43
  },
  {
    "id": 3,
    "path": "bar",
    "kind": "group",
    "full_path": "foo/bar",
44 45 46 47 48 49
  }
]
```

## Search for namespace

50
Get all namespaces that match a string in their name or path.
51 52 53 54 55

```
GET /namespaces?search=foobar
```

56 57 58 59
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `search`  | string | no | Returns a list of namespaces the user is authorized to see based on the search criteria |

60 61
Example request:

62
```bash
63
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/namespaces?search=twitter
64 65
```

66 67
Example response:

68 69 70
```json
[
  {
71 72
    "id": 4,
    "path": "twitter",
73 74
    "kind": "group",
    "full_path": "twitter",
75 76 77
  }
]
```