0

I am trying to create a group using Gitlab CE 12.4.3 The api token is the one generated by the admin account in Gitlab. SO this account has the permission to create groups

curl --header "PRIVATE-TOKEN: 6czXYzu1j7dD16PqtiZw" -d "name=TEST&path=test" -X POST https://mygitlabserver/api/v4/groups

{"message":"403 Forbidden"}

I get an error message saying that it is forbidden.

The token is correct as I manage to list the projects or groups if I do :

curl --header "PRIVATE-TOKEN: 6czXYzu1j7dD16PqtiZw" -X GET https://mygitlabserver/api/v4/groups

or

curl --header "PRIVATE-TOKEN: 6czXYzu1j7dD16PqtiZw" -X GET https://mygitlabserver/api/v4/projects

iclman
  • 1,218
  • 9
  • 21
  • The fact that you can list groups or project is not relevant here. You can always list public groups or public projects without the need for `PRIVATE-TOKEN`. To make sure the token is good, try to get a private project or private group using this token – Aviad Levy Nov 27 '19 at 19:46
  • I forgot to mention all the groups and projects are private. So yes, I managed to create a project with this token and get info for a private project using command such as curl -H "Content-Type: application/json" --header "PRIVATE-TOKEN: 6czXYzu1j7dD16PqtiZw" -X GET https://mygitlabserver/api/v4/projects/5 The parameter gitlab_rails['gitlab_default_can_create_group'] is set to false in /etc/gitlab/gitlab.rb. However, I did not think it would impact the Administrator (root) user. – iclman Nov 28 '19 at 08:38

1 Answers1

2

the root cause is that the gitlab_rails['gitlab_default_can_create_group'] was set to false and even if I was able to create a group via the web interface via the user "Administrator", the creation was forbidden via the API. I had to change the settings for the account administrator and allow it to create a group

iclman
  • 1,218
  • 9
  • 21
  • This can be quite confusing when you use the Administrator account with the web interface. You are able to create groups whereas you can't via the API as long as this option is set. – iclman Dec 06 '19 at 14:01