I think I've seen everything on that scale.
On one end: { status: 200, error: InsufficientFunds }
On the other: - "let's use 409, it perfectly fits our use case" + "but we don't have useful error codes for all the other domain errors."
I think I've seen everything on that scale.
On one end: { status: 200, error: InsufficientFunds }
On the other: - "let's use 409, it perfectly fits our use case" + "but we don't have useful error codes for all the other domain errors."
Let's assume your resource is "/account/1234/withdraw-availability"
It's a hypothetical endpoint you can GET to know if you can withdraw money. You hit it, and the request is sucessful (the server understood and will inform you whether withdrawaw is available or not).
Let's assume your resource is "/account/1234/withdraw"
This other hypothetical endpoint you can POST a request for money withdraw. Returning 200 here means the server understood and processed your request, so a 200 that does not withdraw makes no sense.
The same endpoint could also return a success "201" accepted (the server understood the request, but it is not processed yet). In the body, there would be a link for "/withdrawaws/48957987593845983475/status", a resource specific to this future processing, which you can GET later (maybe 1ms later, within the same socket). This GET could also return a 200, saying that such withdrawaw was not possible (the server sucessfully understood the request and will inform you about the status of the withdrawaw).
For this modeling stuff, the Roy Fielding dissertation about REST is more enlightening than the spec. The spec is still needed though.