Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

new Janus REST API return strange HTTP status codes #586

Open
baszoetekouw opened this issue Jul 22, 2015 · 1 comment
Open

new Janus REST API return strange HTTP status codes #586

baszoetekouw opened this issue Jul 22, 2015 · 1 comment

Comments

@baszoetekouw
Copy link
Contributor

The use of HTTP status codes in the new REST api doen't seem very consistent. I encountered the following two weird status codes (on serviceregistry.test.surfconext.nl) :

  • DELETEing an entity seems to always return 405 (Method not allowed), even though the actual removal works fine. The intention in the code seems to be to return a 204 (No content), which would be quite a bit saner: https://github.com/janus-ssp/janus/blob/develop/src/Janus/ServiceRegistry/Bundle/RestApiBundle/Controller/ConnectionController.php#l269
  • When trying to add (POST) an entity with an entityid that already exists, the API returns 500. Something in the 400-range (409: Conflict, perhaps?) would be more appropiate.
  • When trying to PUT or POST a json without specifying an appropriate Content-type header, the API fails with a 500 error. Error 400 (Bad request) would be more appropriate.
@baszoetekouw
Copy link
Contributor Author

Ah, I seems to have overlooked something: the DELETE case actually returns a 302. My client was redirecting the DELETE to /connections.json, on which it is not supported (and returned the 405).

I don't understand what is causing the 302 though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant