0

Part of my rest API calls and external service. This service could, of course, fail for any reason. What's the suggested code that my API should return to the client?

500 Internal Server Error seems inappropriate: why would I return 500 for something that is not "my fault"?

In this specific case:

  1. the user try to place an order
  2. If order is invalid, 400 would be returned
  3. If order is valid, the order is sent to the external API (which may fail)
  4. The appropriate status code should be returned to the client
gremo
  • 47,186
  • 75
  • 257
  • 421

1 Answers1

1

From this post (HTTP status code for temporarily unavailable pages) it seems like in this situation 503 Service Unavailable is the most appropriate which I myself would also do in this situation.

Boardy
  • 35,417
  • 104
  • 256
  • 447