RestAPISample.xml (apache-openmeetings-6.1.0-src) | : | RestAPISample.xml (apache-openmeetings-6.2.0-src) | ||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven .apache.org/xsd/xdoc-2.0.xsd"> | xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven .apache.org/xsd/xdoc-2.0.xsd"> | |||
<properties> | <properties> | |||
<title>REST API sample</title> | <title>REST API sample</title> | |||
<author email="dev@openmeetings.apache.org">Apache OpenMeetings T eam</author> | <author email="dev@openmeetings.apache.org">Apache OpenMeetings T eam</author> | |||
</properties> | </properties> | |||
<body> | <body> | |||
<section name="Introduction"> | <section name="Introduction"> | |||
<p> For a detailed instruction which services, methods an d params are available see the list in the <a href="/openmeetings-webservice/api docs/index.html" target="_blank">SOAP/REST API</a> . | <p> For a detailed instruction which services, methods an d params are available see the list in the <a href="/openmeetings-webservice/api docs/index.html" target="_blank">SOAP/REST API</a> . | |||
ALL methods that are implemented for the SOAP API are also available via REST. | ALL methods that are implemented for the SOAP API are also available via REST. | |||
</p> | </p> | |||
<div class="bd-callout bd-callout-info"> | ||||
There is a <a href="https://openmeetings.apache.o | ||||
rg/swagger/" target="_blank">OpenAPI spec</a> published in swagger format. | ||||
</div> | ||||
<div> | <div> | |||
you can query methods of each service using follo wing suffixes | You can query methods of each service using follo wing suffixes | |||
<ul> | <ul> | |||
<li>SOAP: <tt>?wsdl</tt> suffix, for exam ple <tt>https://localhost:5443/openmeetings/services/UserService?wsdl</tt></li> | <li>SOAP: <tt>?wsdl</tt> suffix, for exam ple <tt>https://localhost:5443/openmeetings/services/UserService?wsdl</tt></li> | |||
<li>REST: as xml <tt>?_wadl</tt> for exam ple <tt>https://localhost:5443/openmeetings/services/user?_wadl</tt></li> | <li>REST: as xml <tt>?_wadl</tt> for exam ple <tt>https://localhost:5443/openmeetings/services/user?_wadl</tt></li> | |||
<li>REST: as json <tt>?_wadl&type=jso n</tt> for example <tt>https://localhost:5443/openmeetings/services/user?_wadl&a mp;type=json</tt></li> | <li>REST: as json <tt>?_wadl&type=jso n</tt> for example <tt>https://localhost:5443/openmeetings/services/user?_wadl&a mp;type=json</tt></li> | |||
</ul> | </ul> | |||
<div class="bd-callout bd-callout-info"> | <div class="bd-callout bd-callout-info"> | |||
The full list of services with All WSDLs/ WADLs is available at following URL: <tt>https://localhost:5443/openmeetings/ser vices/services</tt> | The full list of services with All WSDLs/ WADLs is available at following URL: <tt>https://localhost:5443/openmeetings/ser vices/services</tt> | |||
</div> | </div> | |||
</div> | </div> | |||
</section> | </section> | |||
<section name="How to get room hash via REST"> | <section name="How to integrate using PHP and composer"> | |||
<p>You can integrate OpenMeetings via the Rest API into y | ||||
our PHP project.</p> | ||||
<div class="bd-callout bd-callout-info"> | ||||
There is a community sponsored free module for in | ||||
tegrating with see: <a href="https://github.com/om-hosting/openmeetings-php-clie | ||||
nt" target="_blank">openmeetings-php-client</a> | ||||
</div> | ||||
<p>Install the module</p> | ||||
<source> | ||||
php composer.phar install openmeetings-php-client | ||||
</source> | ||||
<p>Eg generate a unique hash to enter a conference room:< | ||||
/p> | ||||
<ol> | ||||
<li>Login to service</li> | ||||
<li>Generate Hash for entering a conferen | ||||
ce room</li> | ||||
<li>Construct Login URL</li> | ||||
</ol> | ||||
<source> | ||||
$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()->ge | ||||
tMessage(); | ||||
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; | ||||
</source> | ||||
<p>Full sample source code can be found at <a href="https://githu | ||||
b.com/om-hosting/openmeetings-php-laravel-sample-project" target="_BLANK">https: | ||||
//github.com/om-hosting/openmeetings-php-laravel-sample-project</a> | ||||
</p> | ||||
<p>You can find details about all API endpoints and examples at < | ||||
a href="https://github.com/om-hosting/openmeetings-php-client#documentation-for- | ||||
api-endpoints" target="_blank">https://github.com/om-hosting/openmeetings-php-cl | ||||
ient#documentation-for-api-endpoints</a></p> | ||||
<div class="bd-callout bd-callout-info"> | ||||
A sample PHP use case for a website using Laravel can be | ||||
found here: <a href="https://om-hosting.com/openmeetings-integration-php-compose | ||||
r/" target="_BLANK">https://om-hosting.com/openmeetings-integration-php-composer | ||||
/</a> | ||||
</div> | ||||
</section> | ||||
<section name="How to integrate using Node.js"> | ||||
<p>You can integrate OpenMeetings via the Rest API into y | ||||
our Node project.</p> | ||||
<div class="bd-callout bd-callout-info"> | ||||
There is a community sponsored free module for in | ||||
tegrating with Node.JS see: <a href="https://www.npmjs.com/package/openmeetings- | ||||
node-client" target="_blank">openmeetings-node-client</a> | ||||
</div> | ||||
<p>Install the module</p> | ||||
<source> | ||||
npm install openmeetings-node-client | ||||
</source> | ||||
<p>Eg generate a unique hash to enter a conference room:< | ||||
/p> | ||||
<ol> | ||||
<li>Login to service</li> | ||||
<li>Generate Hash for entering a conferen | ||||
ce room</li> | ||||
<li>Construct Login URL</li> | ||||
</ol> | ||||
<source> | ||||
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}` | ||||
</source> | ||||
<p>Full sample source code for can be found at: | ||||
<ol> | ||||
<li>JavaScript/ES6 example using simplistic Expre | ||||
ss website see <a href="https://github.com/om-hosting/openmeetings-node-js-sampl | ||||
e-project" target="_BLANK">Github openmeetings-node-js-sample-project</a></li> | ||||
<li>TypeScript example using simplistic Express w | ||||
ebsite <a href="https://github.com/om-hosting/openmeetings-node-sample-project" | ||||
target="_BLANK">Github openmeetings-node-sample-project</a></li> | ||||
</ol> | ||||
</p> | ||||
<p>More in depth examples and use cases can be found at the modul | ||||
e page <a href="https://www.npmjs.com/package/openmeetings-node-client" target=" | ||||
_blank">https://www.npmjs.com/package/openmeetings-node-client</a></p> | ||||
<div class="bd-callout bd-callout-info"> | ||||
A sample Node.js use case for a website using Express.js | ||||
can be found here: <a href="https://om-hosting.com/openmeetings-integration-node | ||||
js/" target="_BLANK">https://om-hosting.com/openmeetings-integration-nodejs/</a> | ||||
</div> | ||||
</section> | ||||
<section name="How to get room hash via REST via jQuery"> | ||||
<ul> | <ul> | |||
<li> | <li> | |||
First of all you need to perform login an d get authorized SID to perform authorized operations | First of all you need to perform login an d get authorized SID to perform authorized operations | |||
<table> | <table> | |||
<tr> | <tr> | |||
<td>Request</td> | <td>Request</td> | |||
<td>Error response</td> | <td>Error response</td> | |||
<td>Successful response</ td> | <td>Successful response</ td> | |||
</tr> | </tr> | |||
<tr> | <tr> | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 145 lines changed or added |