Tillerinobot
Tillerinobot copied to clipboard
[API] beatmap info endpoint returns 404 with non-integer wait parameter
While using the api, I accidentally called the beatmap-info endpoint with a wait parameter of 7726.763010025024. It took me a while to find out though because I was getting 404 rather than a 400 as I would expect (since non-integers aren't allowed, right?).
This is interesting. I don't think that the 404 is all to wrong. If you think of it as a "function not found", it does make sense. However it is confusing, I agree.
I'll have to find out what the JAX-RS specification says here and how Jersey implements it. In JAX-RS, resources are uniquely identified by their path not their parameters, so IMO in JAX-RS terms, the resource should be "found" in this case. It might be that JAX-RS didn't specify the behaviour here and that they didn't spend as much thought on this in Jersey. Afterall you'll never have this problem if you use one (Java) interface on both ends, which is probably the most common case for JAX-RS APIs.
Out of curiosity: which programming language are you using and did you generate your API code from the Swagger Spec?
I'm using python (I'm actually trying to write a wrapper library) and just using the requests module's params parameter to encode the query string. So I didn't use swagger to generate the url, just to remind me which parameters are which :P
Try it! AFAICT, swagger's python code generator is decent. It also gives you async calls right off the bat.
On Tue, Jun 6, 2017 at 11:21 AM blimmo [email protected] wrote:
I'm using python (I'm actually trying to write a wrapper library) and just using the requests module's params parameter to encode the query string. So I didn't use swagger to generate the url, just to remind me which parameters are which :P
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/Tillerino/Tillerinobot/issues/140#issuecomment-306430462, or mute the thread https://github.com/notifications/unsubscribe-auth/ABL9ZYrEX8JiPwUI5vwuUAXlv-b6a0Wkks5sBRorgaJpZM4NwmcE .
I don't think there's a necessity to fix this, but I'll leave the issue up just in case anybody else makes the stumbles upon this