Reputation: 79
I am trying to use the Gitlab API to create a release, and was getting familiar with the basics. I have already generated the private token key, but am having trouble with using it properly. Right now, I cannot even list my projects along with its id.
I have used this :
curl "https://gitlab.com/api/v4/projects?private_token=XXXX"
But, I am only seeing a whole lot of data about a host of projects, that are not mine. How do I filter out, or get the data only related to my repo ?
Upvotes: 1
Views: 437
Reputation: 312650
It looks as if you're calling the wrong API. The /projects
endpoint returns a list of all visible projects. To see just a list of projects owned by a particular user (e.g., you), you want the list user projects api:
GET /users/:user_id/projects
For example, I can get a list of my projects like this:
curl -s -H "private-token: $token" https://gitlab.com/api/v4/users/larsks/projects
Which correctly returns a couple of projects from back when I was using gitlab for hosting. The result looks something like:
[
{
"id": 123456,
"description": "",
"name": "kiwi",
[...]
},
{
"id": 654321,
"description": "",
"name": "sensormgr",
[...]
}
]
In your comment on the question, it looks as if you're getting an empty list in response:
[]
Do you own any projects? There certainly aren't any public projects associated with your gitlab account.
Upvotes: 3