Why a HTTP 204?

Added by Jonas over 1 year 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 (4)

RE: Why a HTTP 204? - Added by Nordnet_Support about 1 year ago

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


Reader - Added by Caroline 10 months ago

Why a HTTP 204 come? With some reasons we have come explain the error which come mostly. I want to make perfect because i want when you want to read at that time you never become stuck on any issue and resume planet is matter in the whole material ever.

RE: Why a HTTP 204? - Added by yajof 10 months ago

Taco Bell is an American chain of fast-food restaurants based in Irvine. The Taco Bell was founded by Glen Bell in the year 1962 in Downey, California.


RE: Why a HTTP 204? - Added by Michael 8 months ago

I am a newbie in learning these technical issues of a website recently AffordablePaper as a junior web developer I can help in this but let show the post to my senior who is very professional and experienced and I hope he can solve this problem easily.