How to access GitLab issues using CURL?

The documentation tell you this about how to retrieve issues from a project:

GET /projects/:id/issues

And you tried:

curl --header "PRIVATE-TOKEN: xxx" "https://gitlab.com/api/v3/projects/YYYYYY/issues"

This is correct, but the parameter you give YYYYYY has to be the project id, so it has to be an integer, not text with the project name or path. You need to use something like :

curl --header "PRIVATE-TOKEN: xxx" "https://gitlab.com/api/v3/projects/234/issues"

Where 234 is the id of your project. To get this integer id of your project, simply do a :

curl --header "PRIVATE-TOKEN: xxx" "https://gitlab.com/api/v3/projects

This will list all your projects and will give you the unique integer identifier of a project in the id field:

[
  {
    "id": 4,            <-------- //This one
    "name": "my super mega project",
    "description": null,
    .....

Since GitLab v11.x the /api/v3 returns error "API V3 is no longer supported. Use API V4 instead."

As of version v11 and v12, this works:

curl --header 'PRIVATE-TOKEN: mySecret' https://gitlab.com/api/v4/projects
/2/merge_requests

Parse the output (I recommend jq for that):

[
  {
    "id": 2,            <-------------- use this number below
    "name": "Duke Nukem 3D",

And then:

curl --header 'PRIVATE-TOKEN: mySecret' https://gitlab.com/api/v4/projects/2/issues

Tags:

Curl

Gitlab