3 ms·
> Passing back a blank string would be the bad pattern. That would actually be idiomatic Java behavior. But with REST, I think you should return different sta
by marginalia_nu 4y ago
> Passing back a blank string would be the bad pattern.
That would actually be idiomatic Java behavior.
But with REST, I think you should return different status codes and different types entirely if you're returning an error. Not try to communicate through the presence of absence of fields. You should definitely not return half-complete representations when something half-worked. Either it's complete and guaranteed to be fully populated, or it's not returned at all.
e.g.
HTTP 200: { "message": "hi mom!" }
HTTP 404: { "error": "you came to the wrong neighborhood!" }