Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
0 down vote
favorite


I am using google QPX api to query the flights available using api search But i am not able to get all airlines only limited data is returned with the api may i know is there any limitation to it. Is google flight search not using this api. Because data returned with google flight search and qpx api is different. Please help.

Google Flights https://www.google.co.in/flights/

QPX API https://qpx-express-demo.itasoftware.com/

Please find the code below
C#
[HttpGet]
       public HttpResponseMessage GetFlightdetails()
       {
           try
           {


               #region code 2
               var request = new RootObject
               {
                   request = new Request
                   {
                       passengers = new Passengers
                       {
                           adultCount = 1
                       },
                       slice = new List<Slouse>
                      {
                             new Slouse
                       {
                       origin = "HYD",
                       destination = "DEL",
                       date = "2015-06-08",
                       //permittedCarrier = new List<string>(){"SG"}

                       }

                      },
                       solutions = 200,
                       //refundable = false
                   }
               };

               string requestJson = JsonConvert.SerializeObject(request, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });

               using (var httpClient = new HttpClient())
               {
                   var content = new StringContent(requestJson, Encoding.UTF8, "application/json");
                   var response = httpClient.PostAsync("https://www.googleapis.com/qpxExpress/v1/trips/search?key=XXXXX", content).Result;

                   var res = response.Content.ReadAsStringAsync().Result;


                   //To object QPX
                  // var qpxResponse = JsonConvert.DeserializeObject(d);
                   var resp = new HttpResponseMessage()
                   {
                       Content = new StringContent(res.ToString())
                   };
                   resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                   return resp;
               }
               #endregion
           }
           catch (Exception ex)
           {

               throw;
           }
       }




The above code is found from some other source.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900