You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openmeetings.apache.org by Jibsan Joel Rosa Toirac <ji...@softel.cu> on 2020/06/23 23:01:15 UTC

Re: [MASSMAIL]Aw: API via Rest

WOW thank you Irene, it worked perfectely. Thank you a lot. Just a last question, if I'm going to create a Room, it's the same procedure? 

Greetings, 
Jibsan. 


De: "Irene Weber" <we...@gmx.de> 
Para: "OpenMeetings" <us...@openmeetings.apache.org> 
Enviados: Sábado, 20 de Junio 2020 18:51:21 
Asunto: [MASSMAIL]Aw: API via Rest 

Hello Jibsan, 
this is an example I used some months ago. I think it worked but maybe with some flaws, not sure. I can't test it now. At least, it might give you a hint on how to proceed. 
I used Postman. 
The Service Result message is the sid. You put it in the URL as a parameter. You need to get a fresh sid before you do anything 
[ http://192.168.14.98:5080/openmeetings/services/user/login?&user=admin&pass=my_password | http://192.168.14.98:5080/openmeetings/services/user? ] sid= cc8d1754-87c8-459a-adf7-e2a1a80cba9b 

To add a user, you do a post request. You provide the user data in the body in JSON format. 
Key: user. Value, e.g.: 
{ 
"firstname": "Jibsan", 
"lastname": "Test", 
"externalId": jibsan", 
"password":"QQQ999!!!qqq", 
"login": jibsan, 
"address" : { 
"email": " jib@san.cu" 
} 
} 
I had one more entry in the body: 
Key: confirm 
Value: false 
This is generated by Postman: 
curl --location --request POST 'http:// [ http://192.168.14.98:5080/openmeetings/services/user/login?&user=admin&pass=my_password | 192.168.14.98:5080/openmeetings/services/user ] /?sid=cc8d1754-87c8-459a-adf7-e2a1a80cba9b' \ 
--form 'user= { 
"firstname": " Jibsan ", 
"lastname": "Test", 
"externalId": jibsan ", 
"password":"QQQ999!!!qqq", 
"login": jibsan , 
"address" : { 
"email": " jib@san.cu " 
} 
}' \ 
--form 'confirm=false' 
Deletin a User is simple. 
You do a DEL request like this: 
http:// [ http://192.168.14.98:5080/openmeetings/services/user/login?&user=admin&pass=my_password | 192.168.14.98:5080/openmeetings/services/user/99 ] ?sid=cc8d1754-87c8-459a-adf7-e2a1a80cba9b 
99 is the id of the user to be deleted. 
Regards, 
Irene 
Gesendet: Donnerstag, 18. Juni 2020 um 18:45 Uhr 
Von: "Jibsan Joel Rosa Toirac" <ji...@softel.cu> 
An: "OpenMeetings" <us...@openmeetings.apache.org> 
Betreff: API via Rest 
Hello, I'm using the API via REST and I know how to get the SID to make operations with it, this is the way I'm using it: 
[ http://192.168.14.98:5080/openmeetings/services/user/login?&user=admin&pass=my_password | http://192.168.14.98:5080/openmeetings/services/user/login?&user=admin&pass=my_password ] 
And it retourn this: 
{"serviceResult":{"message":"cc8d1754-87c8-459a-adf7-e2a1a80cba9b","type":"SUCCESS"}} 
That's the SID, no? 
So I want to Add and Delete a new user via REST but I have this from: 
[ http://arisp-phplist-01.dualtec.com.br/red5306/webapps/openmeetings/docs/openmeetings-webservice/apidocs/org/apache/openmeetings/webservice/UserWebService.html | http://arisp-phplist-01.dualtec.com.br/red5306/webapps/openmeetings/docs/openmeetings-webservice/apidocs/org/apache/openmeetings/webservice/UserWebService.html ] 
Which for add is this: 
@POST
 @Path(value="/")
public [ http://openmeetings.apache.org/openmeetings-db/apidocs/org/apache/openmeetings/db/dto/user/UserDTO.html?is-external=true | UserDTO ] add(@QueryParam(value="sid") [ http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true | String ] sid,
                                           @QueryParam(value="user") [ http://openmeetings.apache.org/openmeetings-db/apidocs/org/apache/openmeetings/db/dto/user/UserDTO.html?is-external=true | UserDTO ] user,
                                           @QueryParam(value="confirm") [ http://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html?is-external=true | Boolean ] confirm)
                                    throws [ http://openmeetings.apache.org/openmeetings-db/apidocs/org/apache/openmeetings/webservice.error.ServiceException.html?is-external=true | org.apache.openmeetings.webservice.error.ServiceException ] 
Description copied from interface: org.apache.openmeetings.webservice.cluster.UserService 
Adds a new User like through the Frontend, but also does activates the Account To do SSO see the methods to create a hash and use those ones! 
Specified by: add in interface [ http://openmeetings.apache.org/openmeetings-db/apidocs/org/apache/openmeetings/webservice.cluster.UserService.html?is-external=true | org.apache.openmeetings.webservice.cluster.UserService ] Parameters: sid - The SID from getSession user - user object confirm - whatever or not to send email, leave empty for auto-send Returns: - id of the user added or error code 
And for delete is this: 
@DELETE
 @Path(value="/{id}")
public [ http://openmeetings.apache.org/openmeetings-db/apidocs/org/apache/openmeetings/db/dto/basic/ServiceResult.html?is-external=true | ServiceResult ] delete(@QueryParam(value="sid") [ http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true | String ] sid,
                                                          @PathParam(value="id")
                                                          long id)
                                                   throws [ http://openmeetings.apache.org/openmeetings-db/apidocs/org/apache/openmeetings/webservice.error.ServiceException.html?is-external=true | org.apache.openmeetings.webservice.error.ServiceException ] 
Description copied from interface: org.apache.openmeetings.webservice.cluster.UserService 
Delete a certain user by its id 
Specified by: delete in interface [ http://openmeetings.apache.org/openmeetings-db/apidocs/org/apache/openmeetings/webservice.cluster.UserService.html?is-external=true | org.apache.openmeetings.webservice.cluster.UserService ] Parameters: sid - The SID from getSession id - the openmeetings user id Returns: - id of the user deleted, error code otherwise The problem is tha I dont know how to put those parameters on the URL or Postman to make this operations, please if somebody could send me an URL example with all the parameters it will be great because I've tried but I couldn't find a better explination to that. Thank you for your time. Greetings, Jibsan