Quantcast
Viewing all articles
Browse latest Browse all 3708

HTTP status code for "no data available" from an external datasource

Scenario:

A POST request is sent to process an order that will result in data retrieval from an external datasource.

There are three possible results:

  1. The datasource returned data for the request
  2. No data was available for the request (this is viewed as an error)
  3. The datasource couldn't be accessed (may be down for maintenance)

An obvious response for 1 is 200: OK or 201: Created (an entity is created from this request).

What status codes would be appropriate for 2 and 3?

Status codes I have considered:

  • 503: Service Unavailable when datasource is down
  • 500: Internal Server Error when datasource is down
  • 502: Bad Gateway when "no data available"
  • 404: Not Found when "no data available"
  • 403: Forbidden when "no data available"
  • 412: Precondition Failed when "no data available"

Viewing all articles
Browse latest Browse all 3708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>