What should be status code of my Rest API if it is dependent on third party service and the results from service are invalid?

524 views Asked by At

I have gone through all status code of Web API and couldn't find right fit for below scenario. My API is dependent on third party service and the results from service are invalid, in such case what kind of status code I should return?

400 - Means bad request, and there isn't anything wrong with request. 500 - Raising 500 doesn't make sense as it can be handled and want to give appropriate message in response. 200 - As response is not successful, I can't give any 2XX status code.

Thanks for suggestions in advance.

1

There are 1 answers

0
Chris On

My first thought is:

502 Bad Gateway The server was acting as a gateway or proxy and received an invalid response from the upstream server. Wikipedia