The URL is wrong
https://github.com/apache/openmeetings/blob/5.0.0-M3/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java#L134

you have to

$this->getRestUrl("user")

NOT

$this->getRestUrl("user") . "add"

UserDTO should be URLFormEncoded
the best way to get exact request: run Unit tests with full logging and
check :)

On Thu, 9 Apr 2020 at 13:51, Varga Balázs <join...@gmail.com> wrote:

> Hello Maxim!
>
> First problem, can't create OM user on API.
>
> Logged in on API as primary (id=1) user. This rights:
> Administrator,Rooms,SOAP, type is USER.
>
> Login success, get SID-ok.
>
> Sending /services/user/add(userDTO,confirmation=false);
>
> This is unsuccess, check in logs: method not allowed 405.
>
> $user = array(   'address'=>array('email'=>'nemegy...@bla.bla'),   
> 'login'=>'teszt1',   'password'=>'teszt1',   'firstname'=>'Teszt',   
> 'lastname'=>'blabla',   'languageId'=>17,   'rights'=>array('soap','room'),   
> 'type'=>'external',   //'externalId'=>'id01',   
> //'externalType'=>'Tesztgroup',);
>
> addUser($user,$confirm = false){   $rest = new OmRestService($this->config);  
>  $response = $rest->call(      $this->getRestUrl("user") . "add"      , 
> RestMethod::POST      , $this->sessionId      , http_build_query(array("user" 
> => json_encode($user), "confirm" => $confirm), '', '&')      , null      , 
> "serviceResult"   );
>
>
>
> 2020. 04. 09. 2:58 keltezéssel, Maxim Solodovnik írta:
>
> REST API is covered with uni tests all passes (run with each build)
>
>
> On Thu, 9 Apr 2020 at 05:22, Varga Balázs <join...@gmail.com> 
> <join...@gmail.com> wrote:
>
> Hello Boys!
>
> I try REST API. Many function documentation is incorrect or I not
> understand... or use bad... or have difference API functions on OM
> versions, etc, please help me.
>
> The main rule of Open Source: if you see the bug - fix it and contribute ...
>
>
> Use this source: https://github.com/openmeetings/openmeetings-moodle-plugin
>
> Login via REST is ok, I use one dedicated REST user to connecting, works
> fine. (What a limitation in user credentials: ROOM,SOAP,ADMINISTRATOR )
>
>
> This one I don't understand, please re-phrase
>
>
> To testing get OM version info, ok.
>
> 1: I try getting users list, unsuccess
>
>   OmRestService::call::Array
> (
>      [0] => https://MYHOST:5443/meetings/services/user/get
>      [1] => GET
>      [2] => 0298598a-043a-4140-81c1-f6934b5ebfc6
>      [3] => Array
>          (
>          )
>
>      [4] =>
>      [5] =>
> )
>
> ERROR -[1537] 2020-04-08 22:20:00.932322 31.46.241.199 -->
> OmRestService::call::Request OpenMeetings! OpenMeetings Service failed
> and no response was returned. Additioanl info: Array
>
> Response empty.
>
>
> The documentation describe, required only SID on parameter.  What do I
> do wrong?
>
>
> Please share full sequence of calls
> And I propose to understand what is wrong with one of your calls, then
> go forward
>
>
> 2: I try add user
>
> user = array(
>              'login'=>'teszt1',
>              'password'=>'teszt1',
>              'firstname'=>'Teszt',
>              'lastname'=>'blabla',
>              'email'=>'nemegy...@bla.bla',
>              'languageId'=>17,
>              'rights'=>'soap',
>              'type'=>'user',
>              'externalId'=>'id01',
>              'externalType'=>'Tesztgroup',
>          );
>
> response http 405.
>
>
> DEBUG -[13388] 2020-04-09 00:15:22.258857 31.46.244.158 -->
> OmRestService::call::{"info":{"version":"5.0.0-M3","revision":"b739f87","buildDate":"2019-12-11T11:42:09Z"}}
> ERROR -[13388] 2020-04-09 00:15:22.259072 31.46.244.158 -->
> OmRestService::call::Array
> (
>      [0] => https://MYHOST:5443/meetings/services/user/add
>      [1] => POST
>      [2] => d2f7f1d1-f73a-4207-9bce-e91cba3f1271
>      [3] =>
> user=%7B%22login%22%3A%22teszt1%22%2C%22password%22%3A%22teszt1%22%2C%22firstname%22%3A%22Teszt%22%2C%22lastname%22%3A%22blabla%22%2C%22email%22%3A%22nemegyedi%40bla.bla%22%2C%22languageId%22%3A17%2C%22type%22%3A%22user%22%2C%22externalId%22%3A%22id01%22%2C%22externalType%22%3A%22Tesztgroup%22%7D&confirm=0
>      [4] =>
>      [5] => serviceResult
> )
>
> ERROR -[13388] 2020-04-09 00:15:22.291495 31.46.244.158 -->
> OmRestService::call::Request OpenMeetings! OpenMeetings Service failed
> and no response was returned. Additioanl info: Array
> (
>      [url] 
> =>https://MYHOST:5443/meetings/services/user/add?&sid=d2f7f1d1-f73a-4207-9bce-e91cba3f1271
>      [content_type] =>
>      [http_code] => 405
>      [header_size] => 110
>      [request_size] => 568
>      [filetime] => -1
>      [ssl_verify_result] => 0
>      [redirect_count] => 0
>      [total_time] => 0.030824
>      [namelookup_time] => 3.3E-5
>      [connect_time] => 0.000185
>      [pretransfer_time] => 0.026164
>      [size_upload] => 307
>      [size_download] => 0
>      [speed_download] => 0
>      [speed_upload] => 10233
>      [download_content_length] => 0
>      [upload_content_length] => 307
>      [starttransfer_time] => 0.030805
>      [redirect_time] => 0
>      [redirect_url] =>
>      [primary_ip] => ::1
>      [certinfo] => Array
>          (
>          )
>
>      [primary_port] => 5443
>      [local_ip] => ::1
>      [local_port] => 57700
> )
> 1
> DEBUG -[13388] 2020-04-09 00:15:22.291770 31.46.244.158 -->
> OmRestService::callcUrl error, verbose information:
> * Hostname MYHOST was found in DNS cache
> *   Trying ::1...
> * TCP_NODELAY set
> * Connected to oms1.magyarwebkonferencia.hu (::1) port 5443 (#0)
> * ALPN, offering http/1.1
> * successfully set certificate verify locations:
> *   CAfile: /etc/ssl/certs/ca-certificates.crt
>    CApath: /etc/ssl/certs
> * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
> * ALPN, server did not agree to a protocol
> * Server certificate:
> *  subject: CN=oms1.magyarwebkonferencia.hu
> *  start date: Feb 11 04:20:38 2020 GMT
> *  expire date: May 11 04:20:38 2020 GMT
> *  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
> *  SSL certificate verify ok.
>  > POST
> /meetings/services/user/add?&sid=d2f7f1d1-f73a-4207-9bce-e91cba3f1271
> HTTP/1.1
> Host: MYHOST:5443
> User-Agent: openmeetings
> Accept: */*
> Accept-Encoding: UTF-8
> Content-Length: 307
> Content-Type: application/x-www-form-urlencoded
>
> * upload completely sent off: 307 out of 307 bytes
> < HTTP/1.1 405
> < Allow: DELETE,POST,GET,OPTIONS,HEAD
> < Date: Wed, 08 Apr 2020 22:15:22 GMT
> < Content-Length: 0
> <
> * Connection #0 to host MYHOST left intact
>
>
> I don't create user.
>
>
>
> I need creating room owner users via API, and create your own private room.
>
> Next time log in via api and create room hash, enter to room, create
> many invitation hash into meeting for students.
>
> Howto make this procedure to goods?
>
>
> Regards, Balazs
>
>
> Varga Balázs
> +36-70-389-4753
> SZHWEB Bt.
>
>
> --
> Varga Balázs
> +36-70-389-4753
> SZHWEB Bt.
>
>

-- 
Best regards,
Maxim

Reply via email to