Author: solomax
Date: Thu Aug 18 16:38:21 2016
New Revision: 1756831
URL: http://svn.apache.org/viewvc?rev=1756831&view=rev
Log:
[OPENMEETINGS-1451] SOAP/REST documentation is updated
Modified:
openmeetings/application/branches/3.1.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
openmeetings/application/trunk/openmeetings-server/src/site/xdoc/RestAPISample.xml
openmeetings/site/trunk/RestAPISample.html
Modified:
openmeetings/application/branches/3.1.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-server/src/site/xdoc/RestAPISample.xml?rev=1756831&r1=1756830&r2=1756831&view=diff
==============================================================================
---
openmeetings/application/branches/3.1.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
(original)
+++
openmeetings/application/branches/3.1.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
Thu Aug 18 16:38:21 2016
@@ -19,63 +19,118 @@
<title>REST API sample</title>
<author email="[email protected]">Apache
OpenMeetings Team</author>
</properties>
-
<body>
-
<section name="Introduction">
-
- <p> For a detailed instruction which services, methods
and params are available see the list in the SoapMethods. ALL methods that are
implemented for the SOAP API are also available via REST.
+ <p> For a detailed instruction which services, methods
and params are available see the list in the <a
href="/openmeetings-webservice/apidocs/index.html" target="_blank">SOAP/REST
API</a> .
+ ALL methods that are implemented for the SOAP
API are also available via REST.
</p>
-
+ <div>
+ you can query methods of each service using
following suffixes
+
+ <ul>
+ <li>SOAP: <tt>?wsdl</tt> suffix, for
example
<tt>http://localhost:5080/openmeetings/services/UserService?wsdl</tt></li>
+ <li>REST: as xml <tt>?_wadl</tt> for
example <tt>http://localhost:5080/openmeetings/services/user?_wadl</tt></li>
+ <li>REST: as json
<tt>?_wadl&type=json</tt> for example
<tt>http://localhost:5080/openmeetings/services/user?_wadl&type=json</tt></li>
+ </ul>
+ </div>
</section>
-
- <section name="How to invoke Services via REST">
-
- <p>For example for the method getSession in the
UserService, you would use this URL via REST:
- </p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession</a>
- <p>Result: </p>
- <source>
-<![CDATA[
-<ns:getSessionResponse>
- <ns:return
type="org.apache.openmeetings.hibernate.beans.basic.Sessiondata">
- <ax219:id>156971</ax219:id>
- <ax219:language_id xsi:nil="true"/>
- <ax219:organization_id xsi:nil="true"/>
- <ax219:refresh_time>2011-07-03T14:40:44.000Z</ax219:refresh_time>
- <ax219:sessionXml xsi:nil="true"/>
- <ax219:session_id>26584705202d7c1de6cc8e7e28890e3d</ax219:session_id>
-
<ax219:starttermin_time>2011-07-03T14:40:44.000Z</ax219:starttermin_time>
- <ax219:storePermanent xsi:nil="true"/>
- <ax219:user_id xsi:nil="true"/>
- </ns:return>
-</ns:getSessionResponse>
-]]>
- </source>
- <p>To login a user the call to auth would be:</p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=hans&userpass=test">https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=han&userpass=test</a>
- <p>Result: </p>
- <source>
-<![CDATA[
-<ns:loginUserResponse>
- <ns:return>-11</ns:return>
-</ns:loginUserResponse>
-]]>
- </source>
- <p>=> It does return -10, which is the error id cause
we will not write down a SOAP login to our public server in this wiki. However
the correct way to check this error would be to invoke the call to get the
localized error message. So we invoke the method to get the error via REST:</p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1</a>
- <p>Result:</p>
- <source>
-<![CDATA[
-<ns:getErrorByCodeResponse>
- <ns:return type="org.apache.openmeetings.db.dto.basic.ErrorResult">
- <ax218:errmessage>Username not found</ax218:errmessage>
- <ax218:errorId>-10</ax218:errorId>
- <ax218:errortype>Error</ax218:errortype>
- </ns:return>
-</ns:getErrorByCodeResponse>
-]]>
- </source>
+ <section name="How to get room hash via REST">
+ <ul>
+ <li>
+ First of all you need to perform login
and get authorized SID to perform authorized operations
+ <table>
+ <tr>
+ <td>Request</td>
+ <td>Error response</td>
+ <td>Successful
response</td>
+ </tr>
+ <tr>
+ <td>
+<source>
+$.ajax({
+ method: "GET",
+ url: "services/user/login",
+ data: {user: 'admin', pass: '12345'},
+ dataType: "json"
+});
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": -11,
+ "type": "ERROR"
+ }
+}
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": 1,
+ "message": "78189aff-d68d-458a-8840-5b18d15a50b0",
+ "type": "SUCCESS"
+ }
+}
+</source>
+ </td>
+ </tr>
+ </table>
+ </li>
+ <li>
+ In case of error you can get detailed
error message in your language as result of following query
+
<tt>http://localhost:5080/openmeetings/services/error/<b>ERROR_ID</b>/<b>LANGUAGE_ID</b></tt>
+ (for ex.
http://localhost:5080/openmeetings/services/error/<b>-11</b>/<b>9</b>)
+ </li>
+ <li>If your request was successful you will get
your SID as <b>message</b> (78189aff-d68d-458a-8840-5b18d15a50b0)</li>
+ <li>Then you can use SID to generate room hash
+ <table>
+ <tr>
+ <td>Request</td>
+ <td>Successful
response</td>
+ </tr>
+ <tr>
+ <td>
+<source>
+$.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"
+})
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": 0,
+ "message": "fa1f9381-bd03-42ae-9fd9-332b5f775a1b",
+ "type": "SUCCESS"
+ }
+}
+</source>
+ </td>
+ </tr>
+ </table>
+ </li>
+ <li>If your request was successful you will get
your hash as <b>message</b> (fa1f9381-bd03-42ae-9fd9-332b5f775a1b)</li>
+ <li>Now you can use following URL to enter the
room:
<tt>http://localhost:5080/openmeetings/swf?secureHash=fa1f9381-bd03-42ae-9fd9-332b5f775a1b&language=1</tt></li>
+ </ul>
</section>
</body>
</document>
Modified:
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/RestAPISample.xml?rev=1756831&r1=1756830&r2=1756831&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/RestAPISample.xml
Thu Aug 18 16:38:21 2016
@@ -19,63 +19,118 @@
<title>REST API sample</title>
<author email="[email protected]">Apache
OpenMeetings Team</author>
</properties>
-
<body>
-
<section name="Introduction">
-
- <p> For a detailed instruction which services, methods
and params are available see the list in the SoapMethods. ALL methods that are
implemented for the SOAP API are also available via REST.
+ <p> For a detailed instruction which services, methods
and params are available see the list in the <a
href="/openmeetings-webservice/apidocs/index.html" target="_blank">SOAP/REST
API</a> .
+ ALL methods that are implemented for the SOAP
API are also available via REST.
</p>
-
+ <div>
+ you can query methods of each service using
following suffixes
+
+ <ul>
+ <li>SOAP: <tt>?wsdl</tt> suffix, for
example
<tt>http://localhost:5080/openmeetings/services/UserService?wsdl</tt></li>
+ <li>REST: as xml <tt>?_wadl</tt> for
example <tt>http://localhost:5080/openmeetings/services/user?_wadl</tt></li>
+ <li>REST: as json
<tt>?_wadl&type=json</tt> for example
<tt>http://localhost:5080/openmeetings/services/user?_wadl&type=json</tt></li>
+ </ul>
+ </div>
</section>
-
- <section name="How to invoke Services via REST">
-
- <p>For example for the method getSession in the
UserService, you would use this URL via REST:
- </p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession</a>
- <p>Result: </p>
- <source>
-<![CDATA[
-<ns:getSessionResponse>
- <ns:return
type="org.apache.openmeetings.hibernate.beans.basic.Sessiondata">
- <ax219:id>156971</ax219:id>
- <ax219:language_id xsi:nil="true"/>
- <ax219:organization_id xsi:nil="true"/>
- <ax219:refresh_time>2011-07-03T14:40:44.000Z</ax219:refresh_time>
- <ax219:sessionXml xsi:nil="true"/>
- <ax219:session_id>26584705202d7c1de6cc8e7e28890e3d</ax219:session_id>
-
<ax219:starttermin_time>2011-07-03T14:40:44.000Z</ax219:starttermin_time>
- <ax219:storePermanent xsi:nil="true"/>
- <ax219:user_id xsi:nil="true"/>
- </ns:return>
-</ns:getSessionResponse>
-]]>
- </source>
- <p>To login a user the call to auth would be:</p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=hans&userpass=test">https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=han&userpass=test</a>
- <p>Result: </p>
- <source>
-<![CDATA[
-<ns:loginUserResponse>
- <ns:return>-11</ns:return>
-</ns:loginUserResponse>
-]]>
- </source>
- <p>=> It does return -10, which is the error id cause
we will not write down a SOAP login to our public server in this wiki. However
the correct way to check this error would be to invoke the call to get the
localized error message. So we invoke the method to get the error via REST:</p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1</a>
- <p>Result:</p>
- <source>
-<![CDATA[
-<ns:getErrorByCodeResponse>
- <ns:return type="org.apache.openmeetings.db.dto.basic.ErrorResult">
- <ax218:errmessage>Username not found</ax218:errmessage>
- <ax218:errorId>-10</ax218:errorId>
- <ax218:errortype>Error</ax218:errortype>
- </ns:return>
-</ns:getErrorByCodeResponse>
-]]>
- </source>
+ <section name="How to get room hash via REST">
+ <ul>
+ <li>
+ First of all you need to perform login
and get authorized SID to perform authorized operations
+ <table>
+ <tr>
+ <td>Request</td>
+ <td>Error response</td>
+ <td>Successful
response</td>
+ </tr>
+ <tr>
+ <td>
+<source>
+$.ajax({
+ method: "GET",
+ url: "services/user/login",
+ data: {user: 'admin', pass: '12345'},
+ dataType: "json"
+});
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": -11,
+ "type": "ERROR"
+ }
+}
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": 1,
+ "message": "78189aff-d68d-458a-8840-5b18d15a50b0",
+ "type": "SUCCESS"
+ }
+}
+</source>
+ </td>
+ </tr>
+ </table>
+ </li>
+ <li>
+ In case of error you can get detailed
error message in your language as result of following query
+
<tt>http://localhost:5080/openmeetings/services/error/<b>ERROR_ID</b>/<b>LANGUAGE_ID</b></tt>
+ (for ex.
http://localhost:5080/openmeetings/services/error/<b>-11</b>/<b>9</b>)
+ </li>
+ <li>If your request was successful you will get
your SID as <b>message</b> (78189aff-d68d-458a-8840-5b18d15a50b0)</li>
+ <li>Then you can use SID to generate room hash
+ <table>
+ <tr>
+ <td>Request</td>
+ <td>Successful
response</td>
+ </tr>
+ <tr>
+ <td>
+<source>
+$.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"
+})
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": 0,
+ "message": "fa1f9381-bd03-42ae-9fd9-332b5f775a1b",
+ "type": "SUCCESS"
+ }
+}
+</source>
+ </td>
+ </tr>
+ </table>
+ </li>
+ <li>If your request was successful you will get
your hash as <b>message</b> (fa1f9381-bd03-42ae-9fd9-332b5f775a1b)</li>
+ <li>Now you can use following URL to enter the
room:
<tt>http://localhost:5080/openmeetings/swf?secureHash=fa1f9381-bd03-42ae-9fd9-332b5f775a1b&language=1</tt></li>
+ </ul>
</section>
</body>
</document>
Modified:
openmeetings/application/trunk/openmeetings-server/src/site/xdoc/RestAPISample.xml
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-server/src/site/xdoc/RestAPISample.xml?rev=1756831&r1=1756830&r2=1756831&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-server/src/site/xdoc/RestAPISample.xml
(original)
+++
openmeetings/application/trunk/openmeetings-server/src/site/xdoc/RestAPISample.xml
Thu Aug 18 16:38:21 2016
@@ -19,63 +19,118 @@
<title>REST API sample</title>
<author email="[email protected]">Apache
OpenMeetings Team</author>
</properties>
-
<body>
-
<section name="Introduction">
-
- <p> For a detailed instruction which services, methods
and params are available see the list in the SoapMethods. ALL methods that are
implemented for the SOAP API are also available via REST.
+ <p> For a detailed instruction which services, methods
and params are available see the list in the <a
href="/openmeetings-webservice/apidocs/index.html" target="_blank">SOAP/REST
API</a> .
+ ALL methods that are implemented for the SOAP
API are also available via REST.
</p>
-
+ <div>
+ you can query methods of each service using
following suffixes
+
+ <ul>
+ <li>SOAP: <tt>?wsdl</tt> suffix, for
example
<tt>http://localhost:5080/openmeetings/services/UserService?wsdl</tt></li>
+ <li>REST: as xml <tt>?_wadl</tt> for
example <tt>http://localhost:5080/openmeetings/services/user?_wadl</tt></li>
+ <li>REST: as json
<tt>?_wadl&type=json</tt> for example
<tt>http://localhost:5080/openmeetings/services/user?_wadl&type=json</tt></li>
+ </ul>
+ </div>
</section>
-
- <section name="How to invoke Services via REST">
-
- <p>For example for the method getSession in the
UserService, you would use this URL via REST:
- </p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession</a>
- <p>Result: </p>
- <source>
-<![CDATA[
-<ns:getSessionResponse>
- <ns:return
type="org.apache.openmeetings.hibernate.beans.basic.Sessiondata">
- <ax219:id>156971</ax219:id>
- <ax219:language_id xsi:nil="true"/>
- <ax219:organization_id xsi:nil="true"/>
- <ax219:refresh_time>2011-07-03T14:40:44.000Z</ax219:refresh_time>
- <ax219:sessionXml xsi:nil="true"/>
- <ax219:session_id>26584705202d7c1de6cc8e7e28890e3d</ax219:session_id>
-
<ax219:starttermin_time>2011-07-03T14:40:44.000Z</ax219:starttermin_time>
- <ax219:storePermanent xsi:nil="true"/>
- <ax219:user_id xsi:nil="true"/>
- </ns:return>
-</ns:getSessionResponse>
-]]>
- </source>
- <p>To login a user the call to auth would be:</p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=hans&userpass=test">https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=han&userpass=test</a>
- <p>Result: </p>
- <source>
-<![CDATA[
-<ns:loginUserResponse>
- <ns:return>-11</ns:return>
-</ns:loginUserResponse>
-]]>
- </source>
- <p>=> It does return -10, which is the error id cause
we will not write down a SOAP login to our public server in this wiki. However
the correct way to check this error would be to invoke the call to get the
localized error message. So we invoke the method to get the error via REST:</p>
- <p>Sample URL: </p><a
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1</a>
- <p>Result:</p>
- <source>
-<![CDATA[
-<ns:getErrorByCodeResponse>
- <ns:return type="org.apache.openmeetings.db.dto.basic.ErrorResult">
- <ax218:errmessage>Username not found</ax218:errmessage>
- <ax218:errorId>-10</ax218:errorId>
- <ax218:errortype>Error</ax218:errortype>
- </ns:return>
-</ns:getErrorByCodeResponse>
-]]>
- </source>
+ <section name="How to get room hash via REST">
+ <ul>
+ <li>
+ First of all you need to perform login
and get authorized SID to perform authorized operations
+ <table>
+ <tr>
+ <td>Request</td>
+ <td>Error response</td>
+ <td>Successful
response</td>
+ </tr>
+ <tr>
+ <td>
+<source>
+$.ajax({
+ method: "GET",
+ url: "services/user/login",
+ data: {user: 'admin', pass: '12345'},
+ dataType: "json"
+});
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": -11,
+ "type": "ERROR"
+ }
+}
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": 1,
+ "message": "78189aff-d68d-458a-8840-5b18d15a50b0",
+ "type": "SUCCESS"
+ }
+}
+</source>
+ </td>
+ </tr>
+ </table>
+ </li>
+ <li>
+ In case of error you can get detailed
error message in your language as result of following query
+
<tt>http://localhost:5080/openmeetings/services/error/<b>ERROR_ID</b>/<b>LANGUAGE_ID</b></tt>
+ (for ex.
http://localhost:5080/openmeetings/services/error/<b>-11</b>/<b>9</b>)
+ </li>
+ <li>If your request was successful you will get
your SID as <b>message</b> (78189aff-d68d-458a-8840-5b18d15a50b0)</li>
+ <li>Then you can use SID to generate room hash
+ <table>
+ <tr>
+ <td>Request</td>
+ <td>Successful
response</td>
+ </tr>
+ <tr>
+ <td>
+<source>
+$.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"
+})
+</source>
+ </td>
+ <td>
+<source>
+{
+ "serviceResult": {
+ "code": 0,
+ "message": "fa1f9381-bd03-42ae-9fd9-332b5f775a1b",
+ "type": "SUCCESS"
+ }
+}
+</source>
+ </td>
+ </tr>
+ </table>
+ </li>
+ <li>If your request was successful you will get
your hash as <b>message</b> (fa1f9381-bd03-42ae-9fd9-332b5f775a1b)</li>
+ <li>Now you can use following URL to enter the
room:
<tt>http://localhost:5080/openmeetings/swf?secureHash=fa1f9381-bd03-42ae-9fd9-332b5f775a1b&language=1</tt></li>
+ </ul>
</section>
</body>
</document>
Modified: openmeetings/site/trunk/RestAPISample.html
URL:
http://svn.apache.org/viewvc/openmeetings/site/trunk/RestAPISample.html?rev=1756831&r1=1756830&r2=1756831&view=diff
==============================================================================
--- openmeetings/site/trunk/RestAPISample.html (original)
+++ openmeetings/site/trunk/RestAPISample.html Thu Aug 18 16:38:21 2016
@@ -760,77 +760,154 @@
-
<div class="section">
<h2><a name="Introduction"></a>Introduction</h2>
-
-<p> For a detailed instruction which services, methods and params are
available see the list in the SoapMethods. ALL methods that are implemented for
the SOAP API are also available via REST.
+<p> For a detailed instruction which services, methods and params are
available see the list in the <a
href="/openmeetings-webservice/apidocs/index.html" target="_blank">SOAP/REST
API</a> .
+ ALL methods that are implemented for the SOAP
API are also available via REST.
</p>
-
+
+<div>
+ you can query methods of each service using
following suffixes
+
+
+<ul>
+
+<li>SOAP: <tt>?wsdl</tt> suffix, for example
<tt>http://localhost:5080/openmeetings/services/UserService?wsdl</tt></li>
+
+<li>REST: as xml <tt>?_wadl</tt> for example
<tt>http://localhost:5080/openmeetings/services/user?_wadl</tt></li>
+
+<li>REST: as json <tt>?_wadl&type=json</tt> for example
<tt>http://localhost:5080/openmeetings/services/user?_wadl&type=json</tt></li>
+ </ul>
+ </div>
</div>
-
<div class="section">
-<h2><a name="How_to_invoke_Services_via_REST"></a>How to invoke Services via
REST</h2>
-
+<h2><a name="How_to_get_room_hash_via_REST"></a>How to get room hash via
REST</h2>
-<p>For example for the method getSession in the UserService, you would use
this URL via REST:
- </p>
-
-<p>Sample URL: </p><a class="externalLink"
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getSession</a>
-
-<p>Result: </p>
-
-<div class="source"><pre class="prettyprint">
-
-<ns:getSessionResponse>
- <ns:return
type="org.apache.openmeetings.hibernate.beans.basic.Sessiondata">
- <ax219:id>156971</ax219:id>
- <ax219:language_id xsi:nil="true"/>
- <ax219:organization_id xsi:nil="true"/>
-
<ax219:refresh_time>2011-07-03T14:40:44.000Z</ax219:refresh_time>
- <ax219:sessionXml xsi:nil="true"/>
-
<ax219:session_id>26584705202d7c1de6cc8e7e28890e3d</ax219:session_id>
-
<ax219:starttermin_time>2011-07-03T14:40:44.000Z</ax219:starttermin_time>
- <ax219:storePermanent xsi:nil="true"/>
- <ax219:user_id xsi:nil="true"/>
- </ns:return>
-</ns:getSessionResponse>
+<ul>
+
+<li>
+ First of all you need to perform login
and get authorized SID to perform authorized operations
+
+<table border="0" class="table table-striped">
+
+<tr class="a">
+
+<td>Request</td>
+
+<td>Error response</td>
+
+<td>Successful response</td>
+ </tr>
+
+<tr class="b">
+
+<td>
- </pre></div>
-
-<p>To login a user the call to auth would be:</p>
-
-<p>Sample URL: </p><a class="externalLink"
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=hans&userpass=test">https://demo-openmeetings.apache.org/openmeetings/services/UserService/loginUser?SID=26584705202d7c1de6cc8e7e28890e3d&username=han&userpass=test</a>
-
-<p>Result: </p>
-
<div class="source"><pre class="prettyprint">
+$.ajax({
+ method: "GET",
+ url: "services/user/login",
+ data: {user: 'admin', pass: '12345'},
+ dataType: "json"
+});
+</pre></div>
+ </td>
+
+<td>
-<ns:loginUserResponse>
- <ns:return>-11</ns:return>
-</ns:loginUserResponse>
+<div class="source"><pre class="prettyprint">
+{
+ "serviceResult": {
+ "code": -11,
+ "type": "ERROR"
+ }
+}
+</pre></div>
+ </td>
+
+<td>
- </pre></div>
-
-<p>=> It does return -10, which is the error id cause we will not write
down a SOAP login to our public server in this wiki. However the correct way to
check this error would be to invoke the call to get the localized error
message. So we invoke the method to get the error via REST:</p>
-
-<p>Sample URL: </p><a class="externalLink"
href="https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1">https://demo-openmeetings.apache.org/openmeetings/services/UserService/getErrorByCode?SID=26584705202d7c1de6cc8e7e28890e3d&errorid=-10&language_id=1</a>
-
-<p>Result:</p>
-
<div class="source"><pre class="prettyprint">
+{
+ "serviceResult": {
+ "code": 1,
+ "message": "78189aff-d68d-458a-8840-5b18d15a50b0",
+ "type": "SUCCESS"
+ }
+}
+</pre></div>
+ </td>
+ </tr>
+ </table>
+ </li>
+
+<li>
+ In case of error you can get detailed
error message in your language as result of following query
+
<tt>http://localhost:5080/openmeetings/services/error/<b>ERROR_ID</b>/<b>LANGUAGE_ID</b></tt>
+ (for ex.
http://localhost:5080/openmeetings/services/error/<b>-11</b>/<b>9</b>)
+ </li>
+
+<li>If your request was successful you will get your SID as <b>message</b>
(78189aff-d68d-458a-8840-5b18d15a50b0)</li>
+
+<li>Then you can use SID to generate room hash
+
+<table border="0" class="table table-striped">
+
+<tr class="a">
+
+<td>Request</td>
+
+<td>Successful response</td>
+ </tr>
+
+<tr class="b">
+
+<td>
-<ns:getErrorByCodeResponse>
- <ns:return
type="org.apache.openmeetings.db.dto.basic.ErrorResult">
- <ax218:errmessage>Username not found</ax218:errmessage>
- <ax218:errorId>-10</ax218:errorId>
- <ax218:errortype>Error</ax218:errortype>
- </ns:return>
-</ns:getErrorByCodeResponse>
+<div class="source"><pre class="prettyprint">
+$.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"
+})
+</pre></div>
+ </td>
+
+<td>
- </pre></div>
+<div class="source"><pre class="prettyprint">
+{
+ "serviceResult": {
+ "code": 0,
+ "message": "fa1f9381-bd03-42ae-9fd9-332b5f775a1b",
+ "type": "SUCCESS"
+ }
+}
+</pre></div>
+ </td>
+ </tr>
+ </table>
+ </li>
+
+<li>If your request was successful you will get your hash as <b>message</b>
(fa1f9381-bd03-42ae-9fd9-332b5f775a1b)</li>
+
+<li>Now you can use following URL to enter the room:
<tt>http://localhost:5080/openmeetings/swf?secureHash=fa1f9381-bd03-42ae-9fd9-332b5f775a1b&language=1</tt></li>
+ </ul>
</div>