What API i can use to get list of all repositories?
I need to get: Current user repositories + repositories from groups + repositories from subgroups + repositories where current user are collaborator (reporter for example).
I’m trying to use https://gitlab.com/api/v4/users/:userId/projects, but in the response i have only repositories of current user.
You are using wrong command:
List all projects
Get a list of all visible projects across GitLab for the authenticated user. When accessed without authentication, only public projects with simple fields are returned.
GET /projects
so effectively:
curl --header "PRIVATE-TOKEN: my-token" https://gitlab.example.com/api/v4/projects
you can see the difference in the URL you used which is for user projects.
Thx.
Last question. I hope
Can I disabled Pagination?
per_page Number of items to list per page (default: 20, max: 100)
For example current user have 101 repositories, and I want get they in one response.
Well since the limit is 100, then I would say no, unfortunately not. Technically you could use the x-total headers that are returned and based on the value of this process additional pages. So, when doing a request with per_page=100
and x-total or x-total-pages as > 1, you can then loop it through to get the first page of 100, and then the second page of 100, or in your case the second page with 1 as you have 101 repositories.
Also bear in mind that > 10000 these x-total header values will not be returned.
Ok
I will try something like this:
do request while answer.IsNotEmpty
And then collect all entities from not empty responses.