Project

General

Profile

How to test REST web api in Tigase XMPP Pubsub

Jalpesh Khakhi
Added almost 3 years ago

I have installed Tigase server version 7.0.2 using following link as a reference :

http://goran-subotic.github.io/chat/2015/07/31/how_to_install_tigase_on_ubuntu.html

now. I want to test REST API using HTTP from browser or any other tool like "Postman".

for example : I want to test following HTTP REST API http://mydomain:8080/rest/pubsub/pubsub.mydomain/create-node

Here I have also attached my init.properties file content of Tigase Server.

Can anyone please guide me how can I do this? step by step?

All your suggestions are welcome.

Thank you

init.properties (1.1 KB) init.properties init.properties

Replies (12)

Added by Wojciech Kapcia TigaseTeam almost 3 years ago

I'm not sure what answer you expect. You can access http://mydomain:8080/rest/ to get list of all currently available REST features with description. There are also informations about request type as well as data format. For the PubSub those has also been described here https://projects.tigase.org/projects/tigase-pubsub/wiki/REST_API

So one simple test would be to create-node and then use another request to list all the available nodes.

Your configuration looks OK.

Added by Jalpesh Khakhi almost 3 years ago

Thnks but it is giving me 404 on every request.. does that help ? to guid me in the right direction?

Added by Steffen Larsen almost 3 years ago

First of all remove the old class: --comp-class-3 = tigase.http.rest.RestMessageReceiver. This is an old class for older tigase server versions.

Added by Jalpesh Khakhi almost 3 years ago

Thanks again,, doing it right away just a min.

Added by Jalpesh Khakhi almost 3 years ago

Thanks Steffen, I have done what you have suggested, removed --comp-class-3 = tigase.http.rest.RestMessageReceiver

But still iam getting "404" for below call

http://[Myip]:8080/rest/pubsub/pubsub.[myip]/create-node

Testing

admin@localhost

<node_type>leaf</node_type>

Really Appreciate.

Added by Steffen Larsen almost 3 years ago

You also have these:

@--comp-name-5=http # temp setting

--comp-name-3 = rest@

So remove --comp-name-3 and let --comp-name-5=rest, like so:

--comp-name-5=rest # temp setting

This will make you hit the correct web endpoint (--comp-class-5=tigase.http.HttpMessageReceiver).

Otherwise check your tigase-console.log and see for any errors. Normally it says that the class is not found etc.

Added by Jalpesh Khakhi almost 3 years ago

Thanks Steffen for the reply and help.. I have done what you have suggested. remove --comp-name-3 and let --comp-name-5=rest.

But still I am getting 404 - Not found error.

I am calling the URL as I have mentioned in my previous message.

Added by Steffen Larsen almost 3 years ago

Hmm . Try like Wojciech said, to get all of the REST services by making a

GET http://myhost:8080/rest/

If you still get an error, then please attach the tigase-console.log file .

Added by Steffen Larsen almost 3 years ago

Also remember to do a Basic Auth mechanism when doing the REST calls. (the admin defined in the init.properties file).

Added by Jalpesh Khakhi almost 3 years ago

Thanks for the reply.

I have tried to get all of the REST services by making a http://myhost:8080/rest/ but it shows me "This web page is not available"

Here I have also attached the tigase-console.log file in the attachment.

Can you please give me the steps to do Basic Auth mechanism when doing the REST calls??? as you have mentioned in your previous post to do.

I am very fresher in Tigase and don't know how to do that.

Thanks

Added by Wojciech Kapcia TigaseTeam almost 3 years ago

  • please try removing --monitoring=jmx:9050 from your init.properties

  • performing BasicAuth depends on the tool; in the simplest form (accessing some endpoints from the browser) you will get prompt to enter the details; if you would use curl then you can include username and password in the url.

Added by Jalpesh Khakhi almost 3 years ago

Thanks for the reply. I really appreciate your suggestion and help.

I'll do as you have suggested me and let you know further.

Thanks again :-)

    (1-12/12)