Getting error while using API


#1

throwing error for API calls like mentioned below
TrackStruct[] route = client.GetFlightTrack(“THY721”, false);

There are few more errors seen for other API’s & error message is not really descriptive. Is there any documentation available for the same (for understanding errors).

Error:
An unhandled exception of type ‘System.ServiceModel.ProtocolException’ occurred in mscorlib.dll
Additional information: The remote server returned an unexpected response: (400) Bad Request.


#2

You can find the API reference at the following link. https://flightaware.com/commercial/flightxml/v3/apiref.rvt

It appears you will need to use a flightid, which would look similar to THY721-1513560300-schedule-0001 for today’s flight.


#3

Thank you so much for support…In API referance page it has been mentioned to send Ident as input. Anyway it worked for one case but failed when passed another flightID. Again the error is not descriptive.

TrackStruct[] route = client.GetFlightTrack(“BAW198-1513755900-schedule-0000”, false);
{“End element ‘Fault’ from namespace ‘http://schemas.xmlsoap.org/soap/envelope/’ expected. Found element ‘SOAP-ENV:detail’ from namespace ‘http://schemas.xmlsoap.org/soap/envelope/’. Line 2, position 398.”}


#4

It appears that flight has not flown. We cannot provide a track for a flight that has not departed. Looking at http://flightaware.com/live/flight/id/BAW198-1513755900-schedule-0000, at the time of this writing is shows scheduled to depart in over 17 hours.

From the api reference link above, it states It returns the track log for that flight if it has departed.


#5

Hi,
We are trying to get current flying flight details.
We tried something but it didn’t work.

Can you give us a example how to call the API so that we can get live flight information.


#6

https://flightxml.flightaware.com/json/FlightXML3/GetFlightTrack?ident=BAW189-1513664735-airline-0077&include_position_estimates=false

This flight just took off out of LHR and returns the track.


#7

Thank you for your support.
My problem is I am not able to get correct flightID no. FlightInfoSTatus return many records even after passing date filer like below. Or maybe filter expression I am sending is incorrect.
Can anyone guide how I should be sending correct date filter so that I shoul dget relevant ID of the flight for desired date.

string filterexpr = string.Format(“actual_departure_time.date : ‘{0:dd-MMM-yyyy}’”, DateTime.Now.Date);
ArrayOfFlightInfoStatusStruct f_info = client.FlightInfoStatus(“AI191”, false, filterexpr, 10, 0);
TrackStruct[] route = client.GetFlightTrack(f_info.flights[4].faFlightID, false);

Thanks in advance for your help.

Also, any help on documentation of how to read error messages because error messages are not self descriptive.


#8

Hello,

Can anybody support on this please.


#9

I always do the filtering on the client side, but that’s just me. I use swift that has very powerful and fast filtering on Dictionaries/Arrays etc. Also Swift 4 has some very nice JSON decoding native support. There’s no substitute to reading the API documentation; I would also recommend using a http client like PAW or Charles.