200 status code for Error Api response

  • 17 November 2021
  • 1 reply
  • 121 views

Team,

When I execute a graphql api for few case the api is success and it returns the data.
But if we make any mistakes in constructing the query or some other error then that time in the response it has errors but it gives us 200 as API Status code. How can we distinguish success and failure APIs. 

Can‘t we find this from the API status code ?


1 reply

Userlevel 7
Badge +12

I agree, a status 200 for an erronous query is not very helpful. I do the checks by looking whether the response JSON has the property “errors”.

Reply