Place Details API的short_name更改

Gré*_*reC 5 google-maps google-places-api

Google响应的格式是否发生了变化?几天后,当我使用与国家/地区相对应的place_id参数查询API时,我不再获得任何国家/地区代码(alpha2).

例如:

# Query for "France"
# http://maps.googleapis.com/maps/api/js/GeocodeService.Search?7sUS&9sen&14sChIJMVd4MymgVA0R99lHx5Y__Ws&key=[API_KEY]

"results" : [
  {
     "address_components" : [
        {
           "long_name" : "France",
           "short_name" : "France", <= Used to be "FR"
           "types" : [ "country", "political" ]
        }
     ],
     "formatted_address" : "France",
       ....
     },
     "place_id" : "ChIJMVd4MymgVA0R99lHx5Y__Ws",
     "types" : [ "country", "political" ]
  }
  ],
  "status" : "OK"
  }
Run Code Online (Sandbox Code Playgroud)

但是当我对法国巴黎执行相同的查询时:

"results" : [
  {
     "address_components" : [
        {
           "long_name" : "Paris",
           "short_name" : "Paris",
           "types" : [ "locality", "political" ]
        },
        {
           "long_name" : "Paris",
           "short_name" : "Paris",
           "types" : [ "administrative_area_level_2", "political" ]
        },
        {
           "long_name" : "Île-de-France",
           "short_name" : "Île-de-France",
           "types" : [ "administrative_area_level_1", "political" ]
        },
        {
           "long_name" : "France",
           "short_name" : "FR",  <== Still "FR"
           "types" : [ "country", "political" ]
        }
     ],
     "formatted_address" : "Paris, France",
     "geometry" : {
        "bounds" : {
           "northeast" : {
              "lat" : 48.9021449,
              "lng" : 2.4699208
           },
           "southwest" : {
              "lat" : 48.815573,
              "lng" : 2.224199
           }
        },
        "location" : {
           "lat" : 48.856614,
           "lng" : 2.3522219
        },
        "location_type" : "APPROXIMATE",
        "viewport" : {
           "northeast" : {
              "lat" : 48.9021449,
              "lng" : 2.4699208
           },
           "southwest" : {
              "lat" : 48.815573,
              "lng" : 2.225193
           }
        }
     },
     "place_id" : "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
     "types" : [ "locality", "political" ]
  }
  ],
  "status" : "OK"
  }
  )
Run Code Online (Sandbox Code Playgroud)

它真的改变了吗?如果是这样,我如何获得有关国家/地区的查询的相应country_code?

谢谢你的帮助

xom*_*ena 6

这似乎是一个错误.请查看公共问题跟踪器中的报告:

https://issuetracker.google.com/issues/37479392

随意添加您的评论并解决问题.

UPDATE

该问题已于2017年4月27日由Google解决.