(edited by Dr Ishmael.9685)
[BUG] v2 pagination error message
Why aren’t you using the HTTP response code to check for errors?
Those errors are coming from different levels/servers, so it’s not super surprising they’re different. We can take a look at standardizing but you should always use the HTTP status code first and foremost.
The error code is useful to determine which parameter was invalid.
10 = invalid identifier
90 = invalid language
You could then use that information to do things like display localized error information, which is useful because error responses are always in English regardless of the given ‘lang’ parameter.
https://forum-en.gw2archive.eu/forum/community/api/Return-proper-error-codes/first#post2961806
API v1 was originally using non-informative HTTP codes, so I wrote my module to look at the returned JSON instead. I never bothered updating it after Stefan’s changes because my method “just worked.” I guess I’ll have to update now.
https://forum-en.gw2archive.eu/forum/community/api/Return-proper-error-codes/first#post2961806
API v1 was originally using non-informative HTTP codes, so I wrote my module to look at the returned JSON instead. I never bothered updating it after Stefan’s changes because my method “just worked.” I guess I’ll have to update now.
I can’t possible disagree more with your proposal in that thread, sorry. Errors should always return the most-appropriate HTTP error status code in the response. Extra information kittentainly come back in the response body (and we need to do better standardizing those) but the status code should always be the very first thing any consumer checks once a response is received.