powered by Jive Software

REST API Plugin not returning the right HTTP Status

When I execute a GET request for a room that doesn’t exist, I get an HTTP 500 (Internal Server Error) back instead of HTTP 404 (Not Found), which would be the correct return code for REST.

My Request:

GET http://localhost:9090/plugins/restapi/v1/chatrooms/doesnt.exist/ HTTP/1.1 Accept-Encoding: gzip,deflate Authorization: AUTHCODE Host: localhost:9090 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

The Response:

HTTP/1.1 500 Internal Server Error Date: Sat, 20 Aug 2016 09:45:10 GMT Set-Cookie: JSESSIONID=ino92lblptxfkdxw6at7srmv;Path=/;HttpOnly Expires: Thu, 01 Jan 1970 00:00:00 GMT X-Frame-Options: deny Content-Length: 0

The Server Log is pretty clear:

2016.08.20 11:45:10 ERROR [Jetty-QTP-AdminConsole-63]: org.jivesoftware.openfire.plugin.rest.exceptions.RESTExceptionMapper - RoomNotFoundException: Could not find the chat room with ressource doesnt.exist

I didn’t test it for other entities, but 404 should always be returned for cases where the requested entity isn’t found. HTTP 500 Should really only be returned in case an unexpected Exception occurs.

You are right, I will create a ticket for that.

I’m facing the same problem, and I was not able to find said ticket here :

https://issues.igniterealtime.org/projects/OF/issues

Am I missing something ?

Gugli you can find it here: [OF-1216] REST API plugin return 500 instead of 404 by accessing not existing chat room - IgniteRealtime JIRA