I am currently using GitLab API to return all projects within a group. The question I have is, how do I return all projects if there are over 100 projects in the group?
The curl command I'm using is curl --header "PRIVATE-TOKEN: **********" http://gitlab.example.com/api/v4/groups/myGroup/projects?per_page=100&page=1
I understand that the default page=1 and the max per_page=100 so what do I do if there are over 100 projects? If I set page=2, it just returns all the projects after the first 100.
Check the response for the X-Total-Pages
header. As long as page
is smaller than total pages
, you have to call the api again and increment the page variable.
See https://docs.gitlab.com/ee/api/README.html#pagination-link-header