70
noder
7y

Request URL: /api/v1/user/53b49b5a30
Request Method: GET

Expected Response:
Status Code: 404 Not Found (as the user is actually not present in the DB)

Actual Response:
Status Code: 200 Ok
Response Content:
{
"status": "ERROR",
"errorCode": "404",
"errorMsg": "User Not Found. Please provide a valid user ID",
"type": "Error",
"userMsg": "User Not Found. Please provide a valid user ID"
}

#extremefacepalm

Comments
  • 19
    Everything is fine. Nothing to see here. Move along. Lol
  • 17
    You should be happy you have response in JSON. I had to work with apis which responded with plain text "ERROR" or something like that :-/
  • 5
    I'm trying to do restful api right now and I see more people in devRant rant about this stuff. Man..... devRant is awesome xD
  • 8
    Maybe it shall be a 418 (im a teapod)
  • 4
    @CSaratakij the algo is working!
    *evil laugh*
  • 0
    ARGH WHY
  • 3
    Well, you could use it to give the users a client message. It's not standard behavior, but at least tou can use it... :P
  • 3
    Looks like somebody should rtfm on their backend :p
  • 10
    Currently working with an API where the dev made up his own status codes...
  • 1
    @bittersweet seen that too.. an enum with series of custom error codes and corresponding messages.. it's perfectly fine to use it somewhere else, but not for rest api responses... so, what's the consumer supposed to do ? See if the response is 200, then look into the json for an error, if yes then use the error code attribute ??
  • 8
    @noder It's worse. This API gives back actual HTTP codes, just arbitrarily picked ones. 10 for OK, 11 for a validation error, 16 for not found, etc.

    And the content is not json or xml... it's key value data in strings with all kinds of smartass separators.
  • 0
  • 1
  • 3
    @bittersweet #define smart_ass_operators

    I'm curious lol, worst I've encountered was some game with character stats defined as a pipe separated string with math expressions ..
    Eg. 'hp:100^{level}|mp:30*{level}|...'
  • 0
    @bittersweet I think you should promote that from comment to rant, that's rediculous!
  • 0
    One of the projects I've worked in would only returned 200s. Monitoring that application was dicey.
  • 0
    Lmao. That is all.
  • 0
    Pshh why would you spend all that time implementing status codes when you could just send back a 200 with an extra little message?!

    When I first started my new job it took me quite a while to get used to places that throw 200s nearly regardless of what they should be throwing. 😑😑😑
  • 0
    Another reason to hate this planet 😒
Add Comment