即使在请求中指定了“字段”参数,Google ID调用也将返回所有字段

时间:2019-01-10 11:31:22

标签: google-api google-places-api

Google添加了用于在其“位置详细信息” API中请求特定字段的选项。 我已经将我想要的字段添加到了请求参数中,即使我没有请求其中的某些字段,我仍在获取所有字段。

我的请求网址:

  

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ022Et4sG5xQRtB0kHxBfakc&key= *****&fileds = address_component,adr_address,alt_id,formatted_address,几何形状,图标,id,名称,永久关闭,照片,place_id,plus_code,scope,类型,url,utc_offset,邻近度

这是响应:

       {
    "html_attributions": [],
    "result": {
        "address_components": [
            {
                "long_name": "8021",
                "short_name": "8021",
                "types": [
                    "street_number"
                ]
            },
            {
                "long_name": "Ελευθέριου Βενιζέλου",
                "short_name": "Ελευθέριου Βενιζέλου",
                "types": [
                    "route"
                ]
            },
            {
                "long_name": "Baf",
                "short_name": "Baf",
                "types": [
                    "locality",
                    "political"
                ]
            },
            {
                "long_name": "Baf",
                "short_name": "Baf",
                "types": [
                    "administrative_area_level_1",
                    "political"
                ]
            },
            {
                "long_name": "Cyprus",
                "short_name": "CY",
                "types": [
                    "country",
                    "political"
                ]
            }
        ],
        "adr_address": "56, <span class=\"street-address\">Ελευθέριου Βενιζέλου 8021</span>, <span class=\"locality\">Baf</span>, <span class=\"country-name\">Cyprus</span>",
        "formatted_address": "56, Ελευθέριου Βενιζέλου 8021, Baf, Cyprus",
        "formatted_phone_number": "26 944855",
        "geometry": {
            "location": {
                "lat": 34.7810935,
                "lng": 32.4350841
            },
            "viewport": {
                "northeast": {
                    "lat": 34.7824810802915,
                    "lng": 32.43649373029149
                },
                "southwest": {
                    "lat": 34.7797831197085,
                    "lng": 32.4337957697085
                }
            }
        },
        "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
        "id": "108c7a1119ccc7ecfff72825a5df8bbd6a025192",
        "international_phone_number": "+357 26 944855",
        "name": "New York Sweets",
        "opening_hours": {
            "open_now": true,
            "periods": [
                {
                    "close": {
                        "day": 0,
                        "time": "2100"
                    },
                    "open": {
                        "day": 0,
                        "time": "0900"
                    }
                },
                {
                    "close": {
                        "day": 1,
                        "time": "2100"
                    },
                    "open": {
                        "day": 1,
                        "time": "0900"
                    }
                },
                {
                    "close": {
                        "day": 2,
                        "time": "2100"
                    },
                    "open": {
                        "day": 2,
                        "time": "0900"
                    }
                },
                {
                    "close": {
                        "day": 3,
                        "time": "2100"
                    },
                    "open": {
                        "day": 3,
                        "time": "0900"
                    }
                },
                {
                    "close": {
                        "day": 4,
                        "time": "2100"
                    },
                    "open": {
                        "day": 4,
                        "time": "0900"
                    }
                },
                {
                    "close": {
                        "day": 5,
                        "time": "2100"
                    },
                    "open": {
                        "day": 5,
                        "time": "0900"
                    }
                },
                {
                    "close": {
                        "day": 6,
                        "time": "2100"
                    },
                    "open": {
                        "day": 6,
                        "time": "0900"
                    }
                }
            ],
            "weekday_text": [
                "Monday: 9:00 AM – 9:00 PM",
                "Tuesday: 9:00 AM – 9:00 PM",
                "Wednesday: 9:00 AM – 9:00 PM",
                "Thursday: 9:00 AM – 9:00 PM",
                "Friday: 9:00 AM – 9:00 PM",
                "Saturday: 9:00 AM – 9:00 PM",
                "Sunday: 9:00 AM – 9:00 PM"
            ]
        },
        "photos": [
            {
                "height": 854,
                "html_attributions": [
                    "<a 
href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAAlKTZ5eOmQlupJ-rP71RW8djD8EDVCjb4xWGwpBH0fwBVtZwnnuYxitbabXV_aYTID0clGnlDR0SibQGsOW6i79-tEe-b69qZQ2Y_2k3lW1zpLcP_wrgXANvyKSzbW23XEhB8gIuRI2uYOsmDMpF_L4CsGhR0PpCS20QRffwv3q6MS6HKg4sbdA",
                "width": 640
            },
            {
                "height": 960,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAA715GtCYdgW4fChR9bsEdKJCyqspxFxNaw-wARuswoT4Vi_NC88Cg7LFQIfGAvWUSuKOhmDXBFzGZgOgRdGVjLWmuPUiIV1dMo2BJU2AJH5hpimiDVA2k0CtNwbTAmra1EhBhNKEDAVnd7RJtfkTEvO5NGhS3a9G8XQG16NVHdUGIpgtqv9ZlZw",
                "width": 899
            },
            {
                "height": 720,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/117640002054379729555/photos\">Андрей Тихонов</a>"
                ],
                "photo_reference": "CmRaAAAA1VB5gyNfgeKnHRd_3hEPtcn-ddhHAQFZndcEeLu_w3N1IvtbDtViJfQ-Gjcu_ptCPigLsc3yFUl8cxRruT6ZJpFrMKSbLh544NQqAD72iQmpkpUNm9gy-2J6uAz4g0y2EhBlOHhkFM2RyQbHp8ut9gW7GhSnI2JrjLRNQ7TrZojJebjVLuqUtg",
                "width": 1280
            },
            {
                "height": 1463,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAAJjNiiWBeg0Q4HaqSBg_ndJ7XFugVSKj8_PYkUvWgcwVQaVc3RTTIoShDokWLrEPOS7GV-vilqjTXgmSlQdN_Ju3kXLXWNHkEsnZA3d_EdxieXb4q2KbsWiTVYYmoqK2TEhAyOm3gfdARi6Gz96oaQhr2GhTZK9cSie3dHNUr_GyR3dNCLk8x9g",
                "width": 2000
            },
            {
                "height": 854,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAAPJ3QX0KjX4QFr1NP9H8uyvONNmo95dlbLN5sj6r_65-dzlHfS0_G5wLf3BISu7lIIe8Zzg0DtYcq8l6E1vl-x7vuwsJAGp4Oixn6OoO3BXNKrsJPFc9A5dyxoLqXnjkeEhDS3ZN3V2LMgKB5HTQx4Oq4GhTyuViljWaU_wvEADhvdaoviV05pw",
                "width": 640
            },
            {
                "height": 960,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAA62cqSZn29xr9xtwS2-V2Mgpkxr_uv95zrQbJiQf4D185roywoZhnJMgn4l8UfVdE_DNlBd_OfEJNmt63Ul36G9McPVFh22-k67BSsa6G_GdYl4wOFuAI0hwnp_B0P7dXEhAvKR890R42YW0OJ_CSAFijGhTlkOOdJttXHGLcHXDRQtJb8Cyeuw",
                "width": 720
            },
            {
                "height": 921,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAAB9UnZE_v6khkk1Kdp7vb9V6kK1xw-_H-b5JaASutS-8VNvM8Fk9WkNrpH4NbDkq6rjfBdRJsRE3EX5_31AqU0rWpNL18kvAvNsVafPhuDk5qtxECnTnR0P31NZV5Mv2OEhCTV1AQFseaaV-SWnMNHDa9GhR5cywSvCIs9OFAB-OmZJSdp8ZoUQ",
                "width": 960
            },
            {
                "height": 1152,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAABY8bl7qB-3mI7Q5JUsco0xHp8vJLMyCf8SINMu8TDpIq9pUq1w3jHKXzTbJgVMOb-jzan8lhmxQGSs_BAyCwMEk1MdRJ9XVVXQXjye80vqIYWVQJkHtBj0nYTSCzTe5jEhBdlGpwfMdGcBLrxUEVzD0RGhSeXt6CqHuREAKQllZ2h2_jfA6ehg",
                "width": 2048
            },
            {
                "height": 754,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAAYkuexUvSiG_tVssjPVw3BGsvDjobwD0gjkJKkUOXXEXXlKYi5nSzAjHO3xS7KRd8ZaB3UUj6RUI0IE30ZAecFxMBd-qmORQb5M6Zgt7UrXzpBh2hMlhjGhQdS7WaOQFYEhAhFE8dunrSxpP-jJggmQzDGhSVHHz583G50lFjnX6J0d00u3O6Nw",
                "width": 639
            },
            {
                "height": 1536,
                "html_attributions": [
                    "<a href=\"https://maps.google.com/maps/contrib/109749370461397405510/photos\">Michalis Christofi</a>"
                ],
                "photo_reference": "CmRZAAAAEoDqdNive69uJD2elhZAs50tPQUbBVGJDwULsyEsiHK85pMrwvzjy26SZqXLj4NRB-8lyDxyoFn2oqp6KFlqOyWgwimzv-W3LJDEdlLuUq1-hfU-MgR3PuptbeVf56BYEhAP_3GFlHnFEPijFPt5vNCvGhSEMexeFrcqgLcegYYynFFw3XpytA",
                "width": 2048
            }
        ],
        "place_id": "ChIJ022Et4sG5xQRtB0kHxBfakc",
        "plus_code": {
            "compound_code": "QCJP+C2 Paphos, Cyprus",
            "global_code": "8G6JQCJP+C2"
        },
        "rating": 4.8,
        "reference": "ChIJ022Et4sG5xQRtB0kHxBfakc",
        "reviews": [
            {
                "author_name": "Bill Hax",
                "author_url": "https://www.google.com/maps/contrib/100332769349142525953/reviews",
                "language": "en",
                "profile_photo_url": "https://lh5.googleusercontent.com/-7NYsnw_M3pY/AAAAAAAAAAI/AAAAAAAACLI/iCl3xCE-hyc/s128-c0x00000000-cc-rp-mo-ba3/photo.jpg",
                "rating": 5,
                "relative_time_description": "9 months ago",
                "text": "Best cheesecake brownies u will have! ! We ship them to lebanon ",
                "time": 1522390670
            },
            {
                "author_name": "G. Nad.",
                "author_url": "https://www.google.com/maps/contrib/110675617871447677660/reviews",
                "profile_photo_url": "https://lh3.googleusercontent.com/-W3LviwY-xTM/AAAAAAAAAAI/AAAAAAAAAAA/AKxrwcahlmVGmqRH2R49tcb4WwwxWnIDgw/s128-c0x00000000-cc-rp-mo/photo.jpg",
                "rating": 5,
                "relative_time_description": "3 months ago",
                "text": "",
                "time": 1539151080
            },
            {
                "author_name": "Christina Christofi",
                "author_url": "https://www.google.com/maps/contrib/116812443860721124624/reviews",
                "profile_photo_url": "https://lh5.googleusercontent.com/-DOM0y22sX7Q/AAAAAAAAAAI/AAAAAAAAAAA/AKxrwcYrhk3mTztA81u06_SSqr8YtmTsCg/s128-c0x00000000-cc-rp-mo/photo.jpg",
                "rating": 5,
                "relative_time_description": "5 months ago",
                "text": "",
                "time": 1532377587
            },
            {
                "author_name": "Michalis Christofi",
                "author_url": "https://www.google.com/maps/contrib/109749370461397405510/reviews",
                "profile_photo_url": "https://lh4.googleusercontent.com/-llt-lt53Y4o/AAAAAAAAAAI/AAAAAAAAAAA/AKxrwcbc-3ZahfOATYxC7u8OAOBoo8EINQ/s128-c0x00000000-cc-rp-mo/photo.jpg",
                "rating": 5,
                "relative_time_description": "5 months ago",
                "text": "",
                "time": 1532359074
            },
            {
                "author_name": "Nick F",
                "author_url": "https://www.google.com/maps/contrib/107808115662805818674/reviews",
                "profile_photo_url": "https://lh5.googleusercontent.com/-cuA4HtKIgZA/AAAAAAAAAAI/AAAAAAAAAAk/VqVcEUa9pYQ/s128-c0x00000000-cc-rp-mo-ba4/photo.jpg",
                "rating": 4,
                "relative_time_description": "a month ago",
                "text": "",
                "time": 1542667692
            }
        ],
        "scope": "GOOGLE",
        "types": [
            "bakery",
            "store",
            "point_of_interest",
            "food",
            "establishment"
        ],
        "url": "https://maps.google.com/?cid=5146030047070789044",
        "user_ratings_total": 6,
        "utc_offset": 120,
        "vicinity": "56, Ελευθέριου Βενιζέλου 8021, Πάφος",
        "website": "http://www.newyorksweets.com.cy"
    },
    "status": "OK"
}

1 个答案:

答案 0 :(得分:1)

尝试

fields=address_component,adr_address,alt_id,formatted_address,geometry,icon,id,name,permanently_closed,photo,place_id,plus_code,scope,type,url,utc_offset,vicinity

如果您拼写出了错误的参数,它将被忽略的字段!=字段