HTTP status code for “no data available” from an external datasource

后端 未结 5 1654
梦谈多话
梦谈多话 2020-12-29 01:20

Scenario:

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

There are

5条回答
  •  -上瘾入骨i
    2020-12-29 02:04

    2) Looking back at this, I agree it should probably be either a 204 No Content or maybe a 200 with a body indicating no records or resources could be found depending on the structure returned. 404's are generally used when the resource URI doesn't exist or a resource in the URI is not found in the case of a restful service.

    3) 503 Service Unavailable

    The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

      Note: The existence of the 503 status code does not imply that a
      server must use it when becoming overloaded. Some servers may wish
      to simply refuse the connection.
    

提交回复
热议问题