GitLab offers a very extensive API
The API is located at /api/v4/
The notes how to use the API include:
/
is %2F
)Resources for every aspect of GitLab
Authentication using a token (personal/group/project)
Send token in HTTP header using Private-Token
:
curl "https://gitlab.example.com/api/v4/projects" \
--header "Private-Token: <your_access_token>"
GitLab API returns HTTP headers:
Header | Description |
---|---|
x-next-page |
Index of next page |
x-page |
Index of current page |
x-per-page |
Number of items per page |
x-prev-page |
Index of previous page |
x-total |
Total number of items |
x-total-pages |
Total number of pages |
Keyset-based pagination is also supported
Retrieve projects using a private access token:
curl http://gitlab.${DOMAIN}/api/v4/projects \
--silent \
--header "Private-Token: <TOKEN>"
Check pagination headers:
curl http://gitlab.${DOMAIN}/api/v4/projects \
--silent \
--verbose \
--header "Private-Token: <TOKEN>"