c# - Google Places API 返回邮政编码
问题描述
我正在尝试获取返回的 Google Places API 的邮政编码。
我到处寻找,但似乎找不到人们如何做到这一点的有效示例。
这是我在 Postman 中运行良好的 API:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Sydney®ion=AU&key=xxxxx&libraries=places
这是示例 JSON 响应
{
"predictions": [
{
"description": "xxxxx",
"place_id": "xxx",
"reference": "xxx",
"structured_formatting": {
"main_text": "xxx",
"main_text_matched_substrings": [
{
"length": 2,
"offset": 0
},
],
"status": "OK"
}
我如何获得邮政编码的详细信息?
解决方案
没关系,找到了解决方案。
需要使用另一个 API 端点并像这样插入 place_id:
https://maps.googleapis.com/maps/api/place/details/json?region=AU&key=xxx&place_id=xxxx
推荐阅读
- javascript - gsap中的动画进度条
- python-3.x - Python字典获取多个键
- java - 有没有办法找到一个在折射到另一个包后消失的类?
- java - 使用正则表达式在java中用另一个字符串替换字符串
- pyspark - 从数组pyspark中删除特殊字符
- vue.js - 无法弄清楚如何在表格行 (tr) 上进行 v-for 并呈现具有多列 (td) 的子组件
- mongodb - Mongoose 子文档数组更新
- sql - 使用“使用”时删除限定符错误
- javascript - 将其值更改为最小值或最大值的输入
- javascript - Firefox 在第二次和连续单击滚动到顶部按钮时忽略平滑滚动