Skip to content

[Gitlab.com API] Get <400 bad request> response trying to share project with group.

Summary

Via API: If I call API with a request to attach to project new members group with Owner access level (access level=50) I get code 400 output. The same request with access level < 50 works fine.

Via UI: I'm able to attach group to the project with Owner access level.

Steps to reproduce

Request:

curl -XPOST -H 'PRIVATE-TOKEN: token' -d 'group_id=8468472&group_access=50' 'https://gitlab.com/api/v4/projects/<project>/share'

Output:

{"error":"group_access does not have a valid value"}

What is the expected correct behavior?

It's able to attach members group to project with Owner (50) access level via API call.

Relevant logs and/or screenshots

gkulagin@C6208:~ curl -XPOST -H 'PRIVATE-TOKEN: token' -d 'group_id=8468472&group_access=50' 'https://gitlab.com/api/v4/projects/project/share'

{"error":"group_access does not have a valid value"}

gkulagin@C6208:~ curl -XPOST -H 'PRIVATE-TOKEN: token' -d 'group_id=8468472&group_access=40' 'https://gitlab.com/api/v4/projects/project/share'

{"id":1198335,"project_id":20314048,"group_id":8468472,"group_access":40,"expires_at":null}

Output of checks

This bug happens on GitLab.com