How to hit the GitLab API

GitLab's REST API lives at https://gitlab.com/api/v4 (or your self-managed host). Projects are addressed by numeric id or URL-encoded path, e.g. gitlab-org%2Fgitlab.

Authentication

Public projects can be read without a token. For private data, create a personal access token under Access tokens and send it as the PRIVATE-TOKEN header. In the examples it's written {{GITLAB_TOKEN}}.

Full reference: https://docs.gitlab.com/api/rest/

Get a public project

No token needed for public projects.

curl https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab
Run in PostTaco

Get the current user

curl https://gitlab.com/api/v4/user \
  -H "PRIVATE-TOKEN: {{GITLAB_TOKEN}}"
Run in PostTaco

Your open issues

curl "https://gitlab.com/api/v4/issues?state=opened&scope=assigned_to_me" \
  -H "PRIVATE-TOKEN: {{GITLAB_TOKEN}}"
Run in PostTaco

A project's pipelines

curl "https://gitlab.com/api/v4/projects/{{PROJECT_ID}}/pipelines?per_page=5" \
  -H "PRIVATE-TOKEN: {{GITLAB_TOKEN}}"
Run in PostTaco