0

I just want to clarify regarding the status code in case if there is invalid data in the database.

E.g. If something changed in the data base which cause error when call the GET end point. For instance lets assume in the database there is column to store json as a string. If the format has been changed.

Following link was there, but it specifically discussing about the incorrect input data

REST response code for invalid data

SMPH
  • 2,073
  • 8
  • 33
  • 70
  • i have personally received a 403 for incorrect datatype returned (on my GET method) when i changed everything to POST, i received a 412 – Jason V Jul 15 '17 at 00:29

1 Answers1

0

Hmm... it's an error, so the options are 4XX or 5XX. 4XX errors are client errors; it's not the client's job to enforce validity in the database, so those are out. That leaves 5XX, and it's not clear that there's an obvious fit among those -- so, oddly enough, maybe 500 is the appropriate response?

Maybe we can propose a new one: 599 - My Bad.

shabs
  • 648
  • 3
  • 9
  • Thanks for your quick response. Even in my case we throw `500 internal error `. That's why would like to get thoughts from experts. – SMPH Jul 15 '17 at 00:42
  • Doubt is as @json, mentinoed above if 403 for GET it describe that the server can understood the request. So nothing wrong in the client-side. But for 500-internal we have no clue what has happened in the application level. – SMPH Jul 15 '17 at 00:52