Issue with Create Node REST API call

Peter Rajcani
Added over 4 years ago

I get the following issue when trying to create a node using the REST API:

When I call the create-node API, I get an error stating that "Only Administrator can call the command". i am using HTTP requester where I specified admin as user name with 'tigase' as password.

Here is the full request/response log:

POST http://localhost:8080/rest/pubsub/pubsub@Peters-MacBook-Pro.local/create-node

Accept: application/xml

Content-Type: text/xml

Username: admin@Peters-MacBook-Pro.local




-- response --

200 OK

Transfer-Encoding: chunked

Date: Thu, 11 Dec 2014 23:02:37 GMT

Only Administrator can call the command.

When I create the node using the command line tool with the same user name / password, I get no errors

Replies (8)

Added by Peter Rajcani over 4 years ago

Tigase server configuration:

--comp-class-1 = tigase.muc.MUCComponent

--virt-hosts = Peters-MacBook-Pro.local

--user-db-uri = jdbc:derby:/Applications/Tigase-7.0.0-SNAPSHOT-b3723/tigasedb

--user-db = derby

--admins = admin@Peters-MacBook-Pro.local

--comp-name-4 = message-archive

--comp-name-3 = proxy

config-type = --gen-config-def

--comp-name-2 = pubsub

--comp-name-1 = muc

--cluster-mode = true

--sm-plugins = +message-archive-xep-0136

--debug = server

--comp-class-4 = tigase.archive.MessageArchiveComponent

--comp-class-3 = tigase.socks5.Socks5ProxyComponent

--comp-class-2 = tigase.pubsub.PubSubComponent




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

At page is detailed description of installation of REST scripts for PubSub component and proper configuration.

Current version of REST scripts for PubSub do not require authentication and will work even without valid credentials. Because we allow event unauthenticated users to execute requests to PubSub component we do not set sender of request to jid of authenticated user. We expect that most of requests to PubSub component thru REST API will be unauthorized and protection for unauthorized access will be done using API keys (@--api-keys@).

Due to that we stated at that JID of REST component needs to be added to list of administrators jids.

It is also required that jid of Tigase HTTP API Component is added to list of service admin jids to allow execution of ad-hoc commands.

So in your case following line in etc/ file:

--admins = admin@Peters-MacBook-Pro.local

should look like this:

--admins = admin@Peters-MacBook-Pro.local,http@Peters-MacBook-Pro.local

to allow execution of adhoc PubSub commands using REST component without authentication (as authentication for now is not supported by REST PubSub scripts).

It is however possible to modify REST PubSub scripts to force authentication and use JID of authenticated user as sender of request passed to PubSub component.

Added by Peter Rajcani over 4 years ago

I had to add the admin permission for the pub sub component as well:

--admins = admin@Peters-MacBook-Pro.local,http@Peters-MacBook-Pro.local,pubsub@Peters-MacBook-Pro.local

The PubSub HTTP API returned the same error with just the 'http' component listed.

Can you please put this into the documentation as well? This step is not obvious. Even better, the installation should configure this automatically if user selects to install the HTTP component

Added by raj vasani almost 4 years ago

Thanks Andrzej Wójcik for detail explanation, This helps me a lot.

Added by Wei Sun about 2 years ago

I met the same problem when I use the 7.2.0-SNAPSHOT ,

my File look like this:

admins = [ '', '','']

httpServer {

connections {

    8082 () {

        socket = plain

        domain = ''








Only Administrator can call the command.

Added by Wei Sun about 2 years ago

thanks,i have solve I have solved my problem. File should be like this:

admins = [ '', '','http@localhost']

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam 2 months ago

This issue was already resolved. If you have a new issue please provide more details about the issue which you have.
Most likely you should be using pubsub. as your PubSub component JID.