谷歌机票/ QPX查询,而不目的地 [英] Google Flights/QPX Query Without Destination

查看:151
本文介绍了谷歌机票/ QPX查询,而不目的地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟着<一个href="http://stackoverflow.com/questions/28311410/how-to-retrieve-result-for-google-qpx-with-javascript-jquery-ajax">this发布使用谷歌机票/ QPX API 发送飞行的要求,它的所有作品提供#乘客,原点机场,目的地机场和离开日期。

I followed this post to send flight requests using Google Flights/QPX API and it all works provided # of passengers, an origin airport, a destination airport and departure date.

我要检索特定#人次,同比起源机场和离开日期的所有可能的目的地,从而留下了目的地机场(见所需输出的这里)。然而,这是不可能的,因为API需要的目的地。什么是去了解这一点的最好方式:

I want to retrieve all possible destinations given # of passengers, an origin airport and departure date, thus leaving out destination airport (see desired output here). However, that is not possible because the API requires a destination. What is the best way to go about this:

  • 在同一时间发送给不同的目的地的多个请求? 这将是缓慢和昂贵(0.03 $ /请求)。
  • 其他建议
  • send multiple requests for different destinations at the same time? That would be slow and expensive ($0.03/request).
  • Other suggestions

以下是我的code:

HTML:

<!DOCTYPE html>
<html>
    <head>
        <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
        <script src="test.js"></script>
    </head>
    <body>
            <input type="submit" id="submit" value="Submit">
    </body>
</html>

记者:

var sendRequest = function(){
    var FlightRequest = {
      "request": {
        "passengers": {
          "adultCount": 1
        },
        "slice": [
          {
            "origin": "JFK",
            "date": "2015-05-01"
          }
        ],
        "maxPrice": "USD500",
        "refundable": false
      }
    };

    $.ajax({
     type: "POST",
     url: "https://www.googleapis.com/qpxExpress/v1/trips/search?key=AIzaSyAvLMxCBnpSuvovOiz_VlR5caFtKIZgbHU", 
     contentType: 'application/json', 
     dataType: 'json',
     data: JSON.stringify(FlightRequest),
     success: function (data) {
      console.log(JSON.stringify(data));
    },
      error: function(){
       alert("Access to Google QPX Failed.");
     }
    });
}

$(document).ready(function(){
    $("#submit").click(function(){sendRequest();});
});

我在想什么?有什么建议么?是否有不同的API,它可以做到这一点?

What am I missing? Any suggestions? Is there a different API that can do this?

推荐答案

大多数likley你不能避免QPX API中有多个查询。如果你想用它直接提供的ITA软件由谷歌的业务-version有可能是一个解决方案。这就是所谓的机票购物系统。这也由航空公司和更大的旅行社,但是最可能在小范围预算

Most likley you cant avoid having multiple queries within the QPX API. There might be a solution if you want to use the "business"-version which is offered by ITA Software by Google directly. It's called "Airfare Shopping System". This is also used by airlines and bigger travel agencies but is most-likely in a small-budget range.

但一个想法可能是 Sk​​yscanner上的商业。荫不知道他们的condiciations。然而,它们并根据他们的chached航班特殊的质疑。因此,也许一个缺点是,它不是实时数据和唯一一个天刷新一次。您可能需要检查的限制为。

However an idea might be SkyScanner for Business. Iam not sure about their condiciations. However they offer "special" queries based on their chached flights. So maybe a drawback is that its not real-time data and only refreshed once a day. You might have to check the limitations for that.

可能出现的问题包括以下内容:点击

Possible queries include following: Click

这篇关于谷歌机票/ QPX查询,而不目的地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆