Project

General

Profile

How can I add / delete users using the REST API?

Peter Rajcani
Added about 4 years ago

Can users be added / deleted using REST API? If so what is the request URL and parameters for add/delete user? I can add users using the command line tool but I do not see in the documentation how to add / delete users using REST API.


Replies (4)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 4 years ago

You can add / delete users using REST API. To do so you need to send proper request to REST endpoint.

I assume that all REST scripts are in place - default installation should placed them in proper locations.

To add user with jid test12345@example.com you need to send HTTP PUT request to http://localhost:8080/rest/user/test12345@example.com with following XML as a payload:

<user><password>test12345</password></user>

which will create user test12345@example.com with password set to @test12345@.

To delete user with jid test12345@example.com you need to send HTTP DELETE request to http://localhost:8080/rest/user/test12345@example.com without any payload.

To be able to execute both requests you need to have admin permission and may need to authenticate, ie. using HTTP BASIC authentication.

Added by Peter Rajcani about 4 years ago

Thanks, it worked. Can you please put this into documentation for the HTTP API?

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 4 years ago

I will add examples to HTTP API documentation, I just created task #2534 under which this informations will be added.

Added by Peter Rajcani about 4 years ago

Great, thanks!

    (1-4/4)