Why a HTTP 204?

Added by Jonas about 1 month ago

Is there a reason for returning a HTTP code 204 in some cases?
Example: Listing my accounts -> putting the Id of the account into the call to listing orders made on this account -> 204 Response. ( I assume this is due to that no orders are made on the account )

In my opinion this is a "bad" REST call experience having the caller the need to handle two cases of HTTP response as the same thing, i.e. an empty list of orders. Either the need to handle HTTP status or some kind of null check of the content.
I'd say that in ANY REST call of your API which is expected to return a list of any kind if the list doesn't "exist" at your end return an empty one with HTTP 200.


Replies (1)

RE: Why a HTTP 204? - Added by Nordnet Henrik 8 days ago

I suggest you handle all 200s in the same general way.

/H

(1-1/1)