I have an application where we send a request to two applications parallelly. Once I receive both the responses, I consolidate them to form a final response. When one of the systems fails to send a successful response, what should be the overall HTTP status code as it is a partial response?
I tried to use a common HTTP status code (like 503 service unavailable) incase of partial response. I'm new to web API standards and I'm not sure if this is the right approach.
From the perspective of the client calling your service, there's only 2 broad responses you can return: Success and failure. There is no 'partial failure'.
So if one of the upstream requests fails, I would decide the response code this way:
Ultimately distinct HTTP status codes exist to allow clients to make a decision on 'what to do next'. A 5xx error clearly indicates there was an issue and potentially requires a developer's attention. So another way to think about this is... what do you want the client to do in case one of the upstream services failed?
ideally servers never partially process a HTTP request, but I realize this is not always easy.