Failed to create user with API on Gitlab server

I'm working on API-interface gitlab and follow this documentation: https://docs.gitlab.com/ce/api/users.html#user-creation

. I am getting an error when I try to create a user on the Gitlab server with the following command:

curl --request POST --header "PRIVATE-TOKEN: MY-TOKEN" "http://myserver.com/api/v4/users?email=testemail@gmail.com&password=testPAssword&username=testuser&name=test&reset_password=true"

      

Mistake:

{"message":"500 Internal Server Error"}

      

but i can create projects and branches.

My system information

System:     Ubuntu 16.04
Current User:   git
Using RVM:  no
Ruby Version:   2.3.3p222
Gem Version:    2.6.6
Bundler Version:1.13.7
Rake Version:   10.5.0
Redis Version:  3.2.5
Git Version:    2.10.2
Sidekiq Version:4.2.7

GitLab information
Version:    9.0.0
Revision:   cf020e6
Directory:  /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL:        http://myServer.com
HTTP Clone URL: http://myServer.com/some-group/some-project.git
SSH Clone URL:  git@myServer.com:some-group/some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    5.0.0
Repository storage paths:
- default:  /var/opt/gitlab/git-data/repositories
Hooks:      /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:        /opt/gitlab/embedded/bin/git

      

I also created a php script for it, but it returns the same error as well. my script:

function fireCurl($url, $data = null){

            $content = json_encode($data);
            $curl = curl_init( $url);
            curl_setopt($curl, CURLOPT_HEADER, false);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_HTTPHEADER, array("PRIVATE-TOKEN:". $this->token , "Content-type: application/json"));
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
            $json_response = curl_exec($curl);
            $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            if ( $status != 200 ) {

                $Error = "Error: call to URL $url failed with status $status, response $json_response, curl_error " .curl_error($curl) . ", curl_errno " . curl_errno($curl);
                return $Error;
            }else{
                return $json_response;
            }
            curl_close($curl);
    }

      

Please help me

+3


source to share





All Articles