Search code examples
curlgitlab-ce

How to get all users in a Gitlab repo?


We host our own Gitlab-CE repo. How can I get a list of all the users? I do..

$ curl -H "Project-Token: dkjdlkfjlfj" https://gitlab.domain.com/api/v3/users

but because of pagination, I can only get 20 of the them, which is the default. How can I get all the users?


Solution

  • You cannot disable pagination completely for the GitLab API.

    However, you can increase the max number of returned results from 20 to 100 via the per_page URL parameter:

    $ curl -H "Project-Token: dkjdlkfjlfj" https://gitlab.domain.com/api/v3/users?per_page=100
    

    After that, it's a matter of firing off multiple requests to get all users.