Introduction
For a detailed instruction which services, methods and params are available see the list in the SOAP/REST API . ALL methods that are implemented for the SOAP API are also available via REST.
- SOAP: ?wsdl suffix, for example https://localhost:5443/openmeetings/services/UserService?wsdl
- REST: as xml ?_wadl for example https://localhost:5443/openmeetings/services/user?_wadl
- REST: as json ?_wadl&type=json for example https://localhost:5443/openmeetings/services/user?_wadl&type=json
How to integrate using PHP and composer
You can integrate OpenMeetings via the Rest API into your PHP project.
Install the module
php composer.phar install openmeetings-php-client
Eg generate a unique hash to enter a conference room:
- Login to service
- Generate Hash for entering a conference room
- Construct Login URL
$BASE_URL = "http://localhost:5080/openmeetings"; //1. Login to service $config = new Configuration(); $config->setHost($BASE_URL . '/services'); $userApiInstance = new UserServiceApi(null, $config); $serviceResultLoginWrapper = $userApiInstance->login("soapuser", "!HansHans1"); if ($serviceResultLoginWrapper->getServiceResult()->getType() != "SUCCESS") { $text = "Login Failed " . $serviceResultLoginWrapper->getServiceResult()->getMessage(); return view('hello_index', ['text' => $text]); } $sid = $serviceResultLoginWrapper->getServiceResult()->getMessage(); // 2. Generate Hash for entering a conference room $serviceResultHashWrapper = $userApiInstance->getRoomHash($sid, new ExternalUserDTO( array( "firstname" => "John", "lastname" => "Doe", "external_id" => "uniqueId1", "external_type" => "myCMS", "login" => "john.doe", "email" => "john.doe@gmail.com" ) ), new RoomOptionsDTO( array( "room_id" => 2, "moderator" => true ) ) ); // 3. Construct Login URL $hash = $serviceResultHashWrapper->getServiceResult()->getMessage(); $url = $this->BASE_URL . "/hash?secure=".$hash;
Full sample source code can be found at https://github.com/om-hosting/openmeetings-php-laravel-sample-project
You can find details about all API endpoints and examples at https://github.com/om-hosting/openmeetings-php-client#documentation-for-api-endpoints
How to integrate using Node.js
You can integrate OpenMeetings via the Rest API into your Node project.
Install the module
npm install openmeetings-node-client
Eg generate a unique hash to enter a conference room:
- Login to service
- Generate Hash for entering a conference room
- Construct Login URL
const {UserServiceApi, Configuration} = require("openmeetings-node-client"); const BASE_URL = "http://localhost:5080/openmeetings" const config = new Configuration({ basePath: BASE_URL + "/services" }) // 1. Login to service const loginResult = await userService.login("admin", "!HansHans") // 2. Generate Hash for entering a conference room const hashResult = await userService.getRoomHash(sessionId, { firstname: "John", lastname: "Doe", externalId: "uniqueId1", externalType: "myCMS", login: "john.doe", email: "john.doe@gmail.com" }, { roomId: 1, moderator: true }) // 3. Construct Login URL const loginUrl = `${BASE_URL}/hash?secure=${hashResult.message}`
Full sample source code for can be found at:
- JavaScript/ES6 example using simplistic Express website see Github openmeetings-node-js-sample-project
- TypeScript example using simplistic Express website Github openmeetings-node-sample-project
More in depth examples and use cases can be found at the module page https://www.npmjs.com/package/openmeetings-node-client
How to get room hash via REST via jQuery
- First of all you need to perform login and get authorized SID to perform authorized operations
Request Error response Successful response $.ajax({ method: "GET", url: "services/user/login", data: {user: 'admin', pass: '12345'}, dataType: "json" });
{ "serviceResult": { "code": -11, "type": "ERROR" } }
{ "serviceResult": { "code": 1, "message": "78189aff-d68d-458a-8840-5b18d15a50b0", "type": "SUCCESS" } }
- In case of error you can get detailed error message in your language as result of following query https://localhost:5443/openmeetings/services/error/ERROR_ID/LANGUAGE_ID (for ex. https://localhost:5443/openmeetings/services/error/-11/9)
- If your request was successful you will get your SID as message (78189aff-d68d-458a-8840-5b18d15a50b0)
- Then you can use SID to generate room hash
Request Successful response $.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" })
{ "serviceResult": { "code": 0, "message": "fa1f9381-bd03-42ae-9fd9-332b5f775a1b", "type": "SUCCESS" } }
- If your request was successful you will get your hash as message (fa1f9381-bd03-42ae-9fd9-332b5f775a1b)
- Now you can use following URL to enter the room: https://localhost:5443/openmeetings/hash?secure=fa1f9381-bd03-42ae-9fd9-332b5f775a1b&language=1