Endpoint to list every membership and access level?


I’m currently working with the gitlab API and I’d like to list every project that can be accessed by a user and get the access_level associated.

The endpoint GET /users/:id/memberships returns only direct membership however I have memberships inherited from groups and subgroups.

The only solution I found so far is to get every groups and subgroups the user is member of and then iterate though these to get a list of members in order that I can check the access level.

However doing that sends hundreds of request to the API and it takes between 40 and 60 seconds to complete the whole process, which is not an acceptable duration.

Is there a better way to accomplish that ?

I use an admin account so I can access every endpoints and data available if that matters.

Thank you very much !

There doesn’t seem to be an API command to grab all of that information at once. It’s normal to use a number of API commands if you are looking to collate a whole load of information. To be honest, 40-60 seconds isn’t a lot of time really, considering that most systems that generate reports can take far longer than this. Had it been taking multiple of minutes I would agree that it’s slow.

You could always open an issue with Gitlab and ask if they can make an API command available to grab all of that information in from the users’ membership API: Issues · GitLab.org / GitLab · GitLab