FlightAware Discussions

Question about errors returned by FlightXML2 REST API

Hi,

I am curious about error messages returned from REST API. For now I received a response
{
“error”: “NO_DATA no data available”
}
when I specified wrong ident for FlightInfo. May I expect that in case of all other error messages I will receive similar response - object with single error field ? What will happen for 4xx/5xx errors ?

Thanks,
Ed

from my experience using the API I have seen these main types of errors all 200 ok with error in Json

{"error":"NO_DATA unknown airline INVALID"}
{"error":"INVALID: invalid {faFlightID}"}
{"error":"INVALID_ARGUMENT Inbound flight is not known"}
{"error":"INVALID_ARGUMENT endDate is too far in the future (12 months)"}

There might be more types but I have only seen

NO_DATA
INVALID
INVALID_ARGUMENT

In general the RESTful API will respond with a custom error and HTTP 200 and the error JSON if the web request was valid and the API attempted to process the query.

A 4xx/5xx would indicate an error state that occurred before processing the query. For instance a 401 will be sent for authorization problem and will be an HTML response.