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?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": " j...@san.cu"
}
}
 
 
I had one more entry in the body:
Key: confirm
Value: false
 
 
This is generated by Postman:
curl --location --request POST 'http://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": "j...@san.cu"
}
  }' \
--form 'confirm=false'
 
 
Deletin a  User is simple.
You do a DEL request like this:
http://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" <jibsa...@softel.cu>
An: "OpenMeetings" <user@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:
 
 
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:
 
 
Which for add is this:
 
@POST
 @Path(value="/")
public UserDTO add(@QueryParam(value="sid")
                                           String sid,
                                           @QueryParam(value="user")
                                           UserDTO user,
                                           @QueryParam(value="confirm")
                                           Boolean confirm)
                                    throws 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 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 ServiceResult delete(@QueryParam(value="sid")
                                                          String sid,
                                                          @PathParam(value="id")
                                                          long id)
                                                   throws 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 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

Reply via email to