SpaceTradersAPI / issues-and-suggestions

16 stars 1 forks source link

Create an endpoint that returns status code errors for debugging #108

Closed phyreman closed 3 years ago

phyreman commented 3 years ago

It would be kind of nice to be able to get a response from an endpoint, say /debug/status and POST it a HTTP status code and get the expected response if that error actually occurred. So, say you send "400" in the body of a POST to /debug/status, it should respond with a 400 code, etc. It would work a lot like https://httpstat.us does, but would include the custom error messages (especially for teapotting and rate-limiting responses).

jadlers commented 3 years ago

I'm not quite sure I follow or maybe I just think to narrowly that this fits better under the API documentation. The error responses are different depending on which endpoint you hit. There should be some common structure but each endpoint might return data specific to that endpoint. The issue #105 involves adding example responses for all endpoint. This should include both success and error responses. Something like in the image below. Note that the error is not fully filled out and that it's not live currently, I just added it real quick to give an example.

Would completion of the issue mentioned resolve what you had in mind or is there anything I'm missing?

image

phyreman commented 3 years ago

Yeah that would actually resolve just what I had in mind, but your suggestion sounds a bit easier than my idea and still covers my issue.

jadlers commented 3 years ago

Cool, I'll update the linked issue with some more information and close this one in favor of it. Thanks for pointing out areas in which spacetraders can improve!