[ 
https://issues.apache.org/jira/browse/OPENMEETINGS-2096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16895786#comment-16895786
 ] 

perception commented on OPENMEETINGS-2096:
------------------------------------------

Here is my php code to get sid hash key and after that passed this key to 
another request for generating room hash key.

 

<?php
 ini_set('display_errors', 1);
 error_reporting("E_ALL"); 
 $request = 
'http://192.168.0.168:5080/openmeetings/services/user/login?user=admin&pass=Perception@123';
 $session = curl_init($request);


 // Set curl options by passing session and flags
 // CURLOPT_HEADER allows us to receive the HTTP header
 curl_setopt($session, CURLOPT_HEADER, false);
 
 // CURLOPT_RETURNTRANSFER will return the response
 curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
 
 // Make the request
 curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 
 curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($session);
 
 
 
 //echo $response.json();
 //$http_respond = trim( strip_tags( $response ) );
 //$http_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
 
 $response_data = json_decode($response);
 // print_r($response_data->serviceResult->message); 
 //close cURL resource
 curl_close($session);


 
 //curl execcute
 
 $request2 = 
'http://192.168.0.168:5080/openmeetings/services/user/hash?sid='.$response_data->serviceResult->message;
 $ch = curl_init($request2);
 $data = array(
 'firstname'=> 'admin',
 'lastname' => 'admin',
 'externalId' => '1',
 'externalType' => 'myCMS',
 'login'=> 'admin'
 );
 $test = json_encode($data);

$data2 = array(
 'roomId'=> 5,
 'moderator' => true,
 'showAudioVideoTest' => true

);
 $payload = json_encode(array("user" => $data, "options"=>$data2));
 
 curl_setopt($session, CURLOPT_HEADER, false);
 curl_setopt($ch, CURLOPT_POST, 1);
 //attach encoded JSON string to the POST fields
 curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

//set the content type to application/json
 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
 
 curl_setopt($session, CURLOPT_RETURNTRANSFER, true); 
 //return response instead of outputting
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
 
 $result2 = curl_exec($ch);
 print_r($result2);die;  // here i did not get response in this variable
 
 /*if($errno = curl_errno($ch)) {
 
 $error_message = curl_strerror($errno);
 echo "cURL error (\{$errno}):\n \{$error_message}";
 }*/


 
 if(curl_exec($ch) === false)
 {
 echo 'Curl error: ' . curl_error($ch);die("DSDSD");
 }

//close cURL resource
curl_close($ch);


 
 
 
 
 
 //echo "<pre>";
 //echo $session;
 
 
 // Confirm that the request was transmitted to the OpenMeetings! Image Search 
Service
 if(!$response) {
 die("Request OpenMeetings! OpenMeetings Service failed and no response was 
returned.");
 }

 

 

I have print $result2 variable, which should contained room hash key but page 
is blank. And I did not get room hash key. I have also tried with postman api 
integration software, but still not getting response after running this api 
request to generate room hash key.

 

OR provide me such example link which having documentation about how to 
generate room hash key to access room. 

> Support for generating room hash key
> ------------------------------------
>
>                 Key: OPENMEETINGS-2096
>                 URL: https://issues.apache.org/jira/browse/OPENMEETINGS-2096
>             Project: Openmeetings
>          Issue Type: Bug
>    Affects Versions: 4.0.9
>         Environment: ubuntu, using openmeetings 4.0.9 version
>            Reporter: perception
>            Assignee: Maxim Solodovnik
>            Priority: Major
>         Attachments: postman1.png, postman2.png
>
>
> Hello Sir,
>  
> We have followed below tutorial to generate room hash key 
>  
> [https://openmeetings.apache.org/RestAPISample.html#_toc_how_to_get_room_hash_via_rest]
>  
> First we have generate authorised SID{color:#495057} using below code{color}
> $.ajax({  method: "GET",  url: "services/user/login",  data: {user: 'admin', 
> pass: '12345'},  dataType: "json"});
> Now i need to generate room hash key using below code.
> $.ajax({  method: "POST",  url: 
> "services/user/hash?sid=78189aff-d68d-458a-8840-5b18d15a50b0",  data: {user: 
> JSON.stringify({      firstname: 'John',      lastname: 'Doe',      
> externalId: 'uid1',      externalType: 'myCMS',      login: 'superjohn'      
> }),    options: JSON.stringify({      roomId: 5,      moderator: true,      
> showAudioVideoTest: true      })
>     },  dataType: "json"})
> we have tried these steps in postman tool. Refer below my 2 screenshots. In 
> postman1.png, we have generated admin hash key by adding admin credentials, 
> Now i am going to create room hash key in postman2.png screenshot, but i 
> can't generate it. Please help me in 2nd screenshot about to generate room 
> hash key using postman. Please help me for generating room hash key using 
> postman.
> Thanks 
> Shakil



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to