Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab: create new user via API - 404

Tags:

gitlab

I am trying to create new user using gitlab API v3.

Gitlab API docs: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/users.md#user-creation

I am sending POST request to mygitlabhost/api/v3/users/ with all required data: [email protected]&password=33wrwsdfsf3&username=testone&name=fuuu and it returns me 404. Acutally I can list all users via GET request to mygitlabhost/api/v3/users/ so API seems to be running.

Request details: http://imm.io/120o6

what am I wrong?

like image 239
murich Avatar asked Jul 12 '26 17:07

murich


1 Answers

Note that the issue 3411 "unable to add users to team" has some workaround in place for:

  • Apache
    Add this to /etc/apache2/sites-available/default

  ProxyPass http://127.0.0.1:8085/gitlab/api
  ProxyPassReverse http://127.0.0.1:8085/gitlab/api

  • NGinX
location /api {
  proxy_set_header   X-Forwarded-Proto $scheme;
  proxy_set_header   Host              $http_host;
  proxy_set_header   X-Real-IP         $remote_addr;
  proxy_pass http://gitlab-sock/gitlab/api;
  proxy_redirect default;
}

To fix this problem you can modify the file: app/assets/javascripts/api.js.coffee to match your setup.

In our case the path has gitlab as prefix:

users_path: "/gitlab/api/:version/users.json"
user_path: "/gitlab/api/:version/users/:id.json"
notes_path: "/gitlab/api/:version/projects/:id/notes.json"
like image 137
VonC Avatar answered Jul 17 '26 22:07

VonC