FlightAware Discussions

Search query syntax

What is the syntax for the query string used by Search – actual code examples would be great. My code is generating a null result with the code below. The query string is right out of the XML2 documentation.

    stAuth = structNew();
    stAuth.username = "gruner";
    stAuth.password = "3a96...a72a";
    ws = createObject("webservice", "http://flightxml.flightaware.com/soap/FlightXML2/wsdl", stAuth);

    stSearch = structNew();
    stSearch.query = "{aircraftType {B76* B77*}}";
    stSearch.howMany = 15;
    stSearch.offset = 0;

    aSearchStruct = ws.search(stSearch);

<cfset searchFlights="#aSearchStruct.getSearchResult().getAircraft()#">

<cfloop from="1" to="#ArrayLen(searchFlights)#" index="i">

The query syntax for “Search” is different than for “SearchBirdseyeInFlight”. The query syntax you’re using is intended for SearchBirdseyeInFlight, which supports a more complex query language than Search.

If you really want to use Search, then you must use “-type {B76* B77*}” as the query.

Thanks for the quick response. Fixed the problem.

I think we coders need to take care with these parameters as I notice they are often different across methods such as dest & destination, type & aircraftType.