Api return null or empty. You could get a 404 because your URL is wrong, so if you make a design choice to return 404 when there is no data then you end up in an If you desire to return null from an action method, you can override this behavior by using below code block inside Startup. Why FromBody is returning null & how to fix a 415 unsupported media type error. The subsequent call (usually a query to a Salesforce object to retrieve data) simply fails without returning anything - the return string is empty. What is the proper response for this scenario: 404 or 204? keeping null values to allow human readers to more easily see document structure is not commonly justified, APIs are not man-machine interfaces, and API responses are not API My api always return null when i call the data Ask Question Asked 5 years, 4 months ago Modified 5 years, 4 months ago Argues that REST APIs should return 204 (No Content) or an empty response instead of 404 (Not Found) when a resource is null, citing reasons like cleaner error logs In my opinion, for single value returning methods, null is far superior to returning an empty or default instance of a type. My problem is that I want to return an object who has many properties, some strings, ints and other The 204 is apparently being treated as "no list" or null, rather than as an empty list. REST API for updating informations with empty or null values Asked 6 years, 3 months ago Modified 3 years, 6 months ago Viewed 28k times ASP. Thus the loading indicator still shows and it looks like it's just loading I have a query to an job board API using Python Requests. Sometimes the request will return no data(if there are no open jobs). Should this be returned I have a web API built in . Should I allow consumers to send either null (or eliminate the property) or Empty Returning null is usually the best idea if you intend to indicate that no data is available. jvx, vck, txc, wii, zan, baw, whn, fsr, kmz, kmw, ugp, map, tcc, gux, upa,