如何在 Postman 中使用 Google 地图地理编码 API

问题描述 投票:0回答:1

我正在尝试在 Postman 中使用 Google Geocoding API,但我找不到与该 API 相关的任何文档来了解要使用哪个 URL、在标头或参数中放入什么内容。是否有人在该领域有任何经验?

我添加了一个我想通过 Postman 检索的数据示例。

我尝试在 Google 中手动发出请求,JSON 结果令人满意,但我想在 Postman 中自动化此过程。

google-maps postman geocoding talend
1个回答
0
投票

Google 地理编码 API 的使用取决于您需要的服务端点和参数。

示例文档可在此处

获取

我已尝试使用 Postman Get API 端点进行演示。希望对你有帮助

Postman Screenshot

您将收到 JSON 形式的响应。目前,我没有任何有效的 API 密钥,因此我无法显示正确的响应,但正确的响应看起来像

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "1600",
               "short_name" : "1600",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Amphitheatre Parkway",
               "short_name" : "Amphitheatre Pkwy",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Mountain View",
               "short_name" : "Mountain View",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Santa Clara County",
               "short_name" : "Santa Clara County",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "California",
               "short_name" : "CA",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "94043",
               "short_name" : "94043",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
         "geometry" : {
            "location" : {
               "lat" : 37.4267861,
               "lng" : -122.0806032
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 37.4281350802915,
                  "lng" : -122.0792542197085
               },
               "southwest" : {
                  "lat" : 37.4254371197085,
                  "lng" : -122.0819521802915
               }
            }
         },
         "place_id" : "ChIJtYuu0V25j4ARwu5e4wwRYgE",
         "plus_code" : {
            "compound_code" : "CWC8+R3 Mountain View, California, United States",
            "global_code" : "849VCWC8+R3"
         },
         "types" : [ "street_address" ]
      }
   ],
   "status" : "OK"
}

© www.soinside.com 2019 - 2024. All rights reserved.