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:
- The datasource returned data for the request
- No data was available for the request (this is viewed as an error)
- 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 Unavailablewhen datasource is down500: Internal Server Errorwhen datasource is down502: Bad Gatewaywhen "no data available"404: Not Foundwhen "no data available"403: Forbiddenwhen "no data available"412: Precondition Failedwhen "no data available"