【问题标题】:Can I get restaurants contacts details from a list of entity name and addresses with Google API?我可以使用 Google API 从实体名称和地址列表中获取餐厅联系人详细信息吗?
【发布时间】:2019-07-09 13:21:19
【问题描述】:

我有包含名称和邮政地址的送货餐厅列表,我想调用其中一个 Google API 以获取他们的电话号码...

我找到了有关 google contact api、google maps API 的文档,但从未找到有关如何使用姓名和地址文本查询 API 的直接文档。

【问题讨论】:

    标签: api google-maps google-api


    【解决方案1】:

    目前,没有特定的 API 可以满足您的需求。但是,很少有 API 组合可以用来达到预期的效果:

    1. Place Autocomplete + Place Details:

      用例是自动完成将帮助用户选择 您想获得电话号码的机构,之后 选择地点,所选地点的地点 ID 将 在将返回电话的地方详细信息请求中提供 结果中的机构数量。

    2. Find Place From Query + Place Details:

      这个的用例与第一个类似,但这可以 不太可靠,因为它没有自动完成功能,并且 将主要依赖于用户在查询中提供的内容,但与 第一个,从 Find Place 请求返回的 Place ID 将是 提供给地点详细信息请求。

    您也可以访问Pricing sheet 了解费用。

    【讨论】:

      【解决方案2】:

      如果您有餐厅的地址,则可以使用Find Place 请求获取场所的place_ID,然后使用Places Details 请求检查formatted_phone_number 字段。

      寻找地方样本:

      https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=mcdonalds+new+york+1st+street&inputtype=textquery&key=YOUR_API_KEY

      产量

      {
        "candidates":[
          {
            "place_id":"ChIJcWEq7nVZwokRCaffM0Bqu8o"
          }
        ],
        "status":"OK"
      }
      

      生成的地点 ID 可用于专门请求 formatter_phone_number 的地点详细信息请求:

      https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJcWEq7nVZwokRCaffM0Bqu8o&fields=formatted_phone_number&key=YOUR_API_KEY

      产量

      {
        "html_attributions":[
      
        ],
        "result":{
          "formatted_phone_number":"(212) 477-9171"
        },
        "status":"OK"
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多