文档
官方文档:https://docs.gitlab.com/ee/api/
认证方式
官方文档:https://docs.gitlab.com/ee/api/README.html#authentication
OAuth2 tokens
示例:
curl "https://gitlab.example.com/api/v4/projects?access_token=OAUTH-TOKEN"
curl --header "Authorization: Bearer OAUTH-TOKEN" "https://gitlab.example.com/api/v4/projects"
Personal access tokens
Query参数的key为 private_token
;Header参数的key为 PRIVATE-TOKEN
示例:
curl "https://gitlab.example.com/api/v4/projects?private_token=<your_access_token>"
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects"
curl --header "Authorization: Bearer <your_access_token>" "https://gitlab.example.com/api/v4/projects"
Session cookie
cookie的名称: _gitlab_session
Java Client
https://about.gitlab.com/partners/technology-partners/#api-clients