BigW Consortium Gitlab

namespaces.md 1.27 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 22 23 24
```bash
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/namespaces
```

25 26
Example response:

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
```json
[
  {
    "id": 1,
    "path": "user1",
    "kind": "user"
  },
  {
    "id": 2,
    "path": "group1",
    "kind": "group"
  }
]
```

## Search for namespace

44
Get all namespaces that match a string in their name or path.
45 46 47 48 49

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

50 51 52 53
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `search`  | string | no | Returns a list of namespaces the user is authorized to see based on the search criteria |

54 55
Example request:

56 57 58 59
```bash
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/namespaces?search=twitter
```

60 61
Example response:

62 63 64
```json
[
  {
65 66 67
    "id": 4,
    "path": "twitter",
    "kind": "group"
68 69 70
  }
]
```