Timeline for Http Status Code When Downstream Validation Fails
Current License: CC BY-SA 4.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 17, 2021 at 17:50 | review | Close votes | |||
| Jan 22, 2021 at 3:06 | |||||
| Jan 17, 2021 at 17:34 | comment | added | gnat | Does this answer your question? Should HTTP status codes be used to represent business logic errors on a server? | |
| Oct 22, 2019 at 0:01 | answer | added | VoiceOfUnreason | timeline score: 4 | |
| Oct 21, 2019 at 19:48 | answer | added | Robert Harvey | timeline score: 4 | |
| Oct 21, 2019 at 19:45 | comment | added | Prashant Pandey | Could you add this as an answer? | |
| Oct 21, 2019 at 19:44 | comment | added | Robert Harvey | 4xx implies that the request never got there. In order to get a valid message from your app (positive or negative), I think it would have to be a 200. | |
| Oct 21, 2019 at 19:41 | comment | added | Prashant Pandey | So, should I be sending a 4xx only in cases where the request does not follow my contract? Can I send 4xx as part of when some internal validation failed? Say for example, in the /pay call, the client sends me a paymentId that is not associated with the order (a wrong paymentId). Should I send a 4xx or a 2xx with a app code? | |
| Oct 21, 2019 at 19:35 | comment | added | Robert Harvey | Yes, that's how I see it. HTTP status codes don't have any notion of "business rules." | |
| Oct 21, 2019 at 19:34 | comment | added | Prashant Pandey | Does that mean I should never use HTTP status codes to represent business logic statuses? Should I be using custom application codes for that? | |
| Oct 21, 2019 at 19:31 | comment | added | Robert Harvey | You mean whether the HTTP request itself was accepted successfully? That's a 200. | |
| Oct 21, 2019 at 19:30 | comment | added | Prashant Pandey | The status of the request? | |
| Oct 21, 2019 at 19:30 | comment | added | Robert Harvey | What do you want to convey in your HTTP status code? | |
| Oct 21, 2019 at 19:29 | comment | added | Prashant Pandey | @RobertHarvey Can you explain a bit more on that? In fact, I am using my own custom codes for communicating that. They are much more detailed. I am just conflicted on a 4xx and a 5xx. Thanks! | |
| Oct 21, 2019 at 19:27 | comment | added | Robert Harvey | Don't use HTTP status codes to communicate credit card status. They weren't designed to do that. | |
| Oct 21, 2019 at 19:16 | history | asked | Prashant Pandey | CC BY-SA 4.0 |