Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gitlab api get group list only 20 groups not all

Tags:

curl

gitlab

We use Gitlab 7.8, i'm trying to get full list of groups on our prod server via gitlab api, unfortunately gitlab api is returning only 20 groups out of 80 available group. Any help in this would be appreciated.

command used is curl -k --header "PRIVATE-TOKEN: token of admin users"  https://server_name/api/v3/groups

Running this as admin and adding admin account to all the groups didn't help either.

like image 764
maestromani Avatar asked Apr 24 '15 11:04

maestromani


2 Answers

20 is the default number of results returned by GitLab API

You could pass the per_page=80 parameter, to get your 80 expected groups.

like image 199
VonC Avatar answered Oct 16 '22 16:10

VonC


As well as the 'per_page=100' I would also recommend using 'page=' also, if you have more repositories than the maximum value of per_page. You can specify a maximum per_page value of 100.

Something like curl -k --header "PRIVATE-TOKEN: token of admin users" https://server_name/api/v3/groups?page=1&per_page=100

like image 41
Dante Avatar answered Oct 16 '22 15:10

Dante