README.md 1.5 KB
Newer Older
1
# GitLab API
N
Nihad Abbasov 已提交
2

V
Valeriy Sizov 已提交
3
All API requests require authentication. You need to pass a `private_token` parameter by url or header. You can find or reset your private token in your profile.
N
Nihad Abbasov 已提交
4

R
Rob Taylor 已提交
5
If no, or an invalid, `private_token` is provided then an error message will be returned with status code 401:
N
Nihad Abbasov 已提交
6 7 8 9 10 11 12

```json
{
  "message": "401 Unauthorized"
}
```

13
API requests should be prefixed with `api` and the API version. The API version is equal to the GitLab major version number, which is defined in `lib/api.rb`.
N
Nihad Abbasov 已提交
14

R
Rob Taylor 已提交
15
Example of a valid API request:
N
Nihad Abbasov 已提交
16 17

```
R
Riyad Preukschas 已提交
18
GET http://example.com/api/v3/projects?private_token=QVy1PB7sTxfy4pqfZM1U
N
Nihad Abbasov 已提交
19 20 21 22
```

The API uses JSON to serialize data. You don't need to specify `.json` at the end of API URL.

N
Nihad Abbasov 已提交
23 24 25 26 27
#### Pagination

When listing resources you can pass the following parameters:

+ `page` (default: `1`) - page number
N
Nihad Abbasov 已提交
28
+ `per_page` (default: `20`, max: `100`) - number of items to list per page
N
Nihad Abbasov 已提交
29

N
Nihad Abbasov 已提交
30 31 32
## Contents

+ [Users](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/users.md)
33
+ [Session](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/session.md)
N
Nihad Abbasov 已提交
34
+ [Projects](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md)
R
randx 已提交
35
+ [Snippets](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/snippets.md)
N
Nihad Abbasov 已提交
36
+ [Repositories](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repositories.md)
N
Nihad Abbasov 已提交
37
+ [Issues](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/issues.md)
38
+ [Milestones](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/milestones.md)
N
Nihad Abbasov 已提交
39
+ [Notes](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/notes.md)