Параметр "Поле" отеля для API Google Адресов - PullRequest
0 голосов
/ 20 сентября 2019

У меня возникла проблема с реализацией API Google Адресов из-за невозможности найти правильные параметры "поля" для некоторых элементов.

См .: https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJn0TrD9Q3zDERSpw1Ns9muFs&fields=name,photo,geometry,formatted_address,vicinity,rating,review,user_ratings_total&key={YOUR_API_KEY}

Вот JSONответ:

{
   "html_attributions" : [],
   "result" : {
      "formatted_address" : "Kuala Lumpur City Centre, 50088 Kuala Lumpur, Wilayah Persekutuan Kuala Lumpur, Malaysia",
      "geometry" : {
         "location" : {
            "lat" : 3.1561671,
            "lng" : 101.7119496
         },
         "viewport" : {
            "northeast" : {
               "lat" : 3.157424180291502,
               "lng" : 101.7130123302915
            },
            "southwest" : {
               "lat" : 3.154726219708498,
               "lng" : 101.7103143697085
            }
         }
      },
      "name" : "Mandarin Oriental, Kuala Lumpur",
      "photos" : [
         {
            "height" : 1192,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAOT6FULIBbUn82JW5CNDqzQsROTWqRlo5uO6Hnk9qkwCih1GQz6GIDNepcUlB-yF6UsezZDrrTxNv_f1FqrVFNnV-9IjeX_9ejuDbyuZATzsO-buuxod7YPow-2UHIoUhEhB4HKi5ECdMQhZpwaC6gPgaGhTXNDaZxbWO7qa018TkbTx9qwXMoQ",
            "width" : 2119
         },
         {
            "height" : 3307,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAEVcDOAr8ivm18crhxOsgSXL1I2zWZ0ZqFTQgmXBGTQdax85HbssiWF_xQ0P_J9cHe6GLwt0--niWW9AdxkQzJz-lCk-SEzlgbYziWLkGNlxToSqxywjG3ds-VB0PQsZnEhClzNhh9AXRlh5uqY9qT7i7GhQQxUVSbuvaJ8AllGKqcyf-_FMXyw",
            "width" : 4961
         },
         {
            "height" : 3120,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/111868135439388902215/photos\"\u003ebilal ghani\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAXP40zrbbfVkkOeg4eGj44HgIbm90ifFsOfT-y8jBHxNFRjx9UMcgl7CNuEt37ZLalDQn3SX7Rw_QcX8TyEykfu42l4OsUzLy3HXdKIlFt98OJsQGQV0oqZNS6rsOpb79EhB6-mdZTUvH-d-LSj31h_BnGhSnI5oJqeBaKyWHq4AZPXh-ifH_Ug",
            "width" : 4160
         },
         {
            "height" : 4608,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/115593876898833891780/photos\"\u003esaleh abdulrahman\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAsDaQUa7ocID8IaIkQuP_GTD8RjFFIRxhoG_rQN7XnqyQ5oZ0-WvPloUfThngR63ElvQkAUzMFZu31We7ssXDIBJ25nnhqSBkkMDEuHta1BYNUk6S5K8bzOGEAuAmCuonEhDMiU9I8ayN3_oiu6X-Py4dGhRGsAyz7ynBYCPpLcMG8lYXJ-Kc4Q",
            "width" : 3456
         },
         {
            "height" : 2843,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAyxfpTQ7EcPbBYH17vYDiZYIuk7Kgxps3c7gmDZUMRBfjx4kNz8DSO0JTW18HCmqz9g-88NWjO-RW98OhMdjVFKxUrTlMKYP0lY3n8OE8Uc-Co77i8H4AOZX23V-aqWyrEhDW1CmMhiF4-hOM7QeVXEQzGhQf4DSTdCFUJ6doNi_FmTHJdOC8ag",
            "width" : 4364
         },
         {
            "height" : 2666,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAbQDM9rYrpVc5nPWJIWYtnEMdJu5FKinf-2AZWVQO7bR4lCpijj7LO3Y3cAOsVTAbgDSn0VcifxXd64Fok-w7aLjZNIPvb7QXeZu_qX6GMGKAbtcy0n4_4Rrwj6ZFZx7WEhCrFls4mBoWwwe6UVTWleJPGhThEt8clEqf2m24ZIZ-6WEuT149iA",
            "width" : 3999
         },
         {
            "height" : 3000,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAWpvD93KSTtcbPmn_BWptxCm4ObLih2Qt4x6yVzqMDUis16T6rfti_sLHHlevVbwkVtY-jYAUmoxmd86W6HhkGntLC9VXf-Z0QZcdP0S8-jgeYdMW8mvThpCvoDtGpPBnEhA2XxrfAINBqjq_BrkGxZ8QGhSGUOURYr2JHsYC9agcqKQU-5kz-Q",
            "width" : 4500
         },
         {
            "height" : 467,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAW8TUqWEg_8hC3hhsoHQHE0n8ultdT7M9M1qSlPZqKZ0XDdQe7_oYrhsufK656R5zIFNb3t7Q3KcRxho28i6FsNIm3_4ML2kNJ8uMNu1UndWYvC3lm0I1qm0jblZvy3-lEhB2olHR2d01u9LPgWBXVykuGhQxFmEC96cgNWIJSZW8OIhb3HpBHg",
            "width" : 700
         },
         {
            "height" : 467,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAArplK01GLjU3uQCY7obE0tO3f9ZvizY6Fplav1TF9ryjnwTImr2rC-8qODJoKmjufaHp3-4AkI1dz2VGuAdNpZQO0Kmy45O2rzRXwdF1WFPij2e2NtNjXogtSp5WHJf7tEhB_pXXPDzd5gktXBCsl6hYMGhTxA-VpvmtQOSttbKVdyJgI7-SYNw",
            "width" : 700
         },
         {
            "height" : 467,
            "html_attributions" : [
               "\u003ca href=\"https://maps.google.com/maps/contrib/104383969054663440737/photos\"\u003eMandarin Oriental, Kuala Lumpur\u003c/a\u003e"
            ],
            "photo_reference" : "CmRaAAAAunnGhHcbM_1Sm8qn8ZR6oh_aQJbdFwtlJEiu-uAn4M3bo5bsQb_Wsu3DivzlcMAOY1Z0ixp9HSrczFJKBrbLLtPD0XzjJQrJ-t1PzxOXf-OJS26Sa_trysFS9Mqfg3J1EhBQwzv_E5OmJujEbNcdKLLjGhT1BMfK3ErOa_8vRpe6bCDcWuuqQg",
            "width" : 700
         }
      ],
      "rating" : 4.6,
      "reviews" : [
         {
            "author_name" : "Simon Stepsys",
            "author_url" : "https://www.google.com/maps/contrib/114898362461195160979/reviews",
            "language" : "en",
            "profile_photo_url" : "https://lh3.googleusercontent.com/a-/AAuE7mAiaiUNEx9J7rLm3u3ExoVn0yj1tN0RE8IHTH8mCQ=s128-c0x00000000-cc-rp-mo-ba6",
            "rating" : 5,
            "relative_time_description" : "2 months ago",
            "text" : "Absolutely stunning hotel! The best in KL. \n\nThis hotel is closer to 6 stars ? it’s that good!\n\nImmaculately kept throughout. \n\nRooms are stunning. \n\nGym is amazing! Lots of the very best equipment. \n\nSauna, steam room, cool dip pool, relaxing area with coffee and teas. \n\n Great cigar lounge! \n\nBreakfast is stunning! Seriously as good as any where I’ve ever stayed. \n\nSwimming ?‍♀️ pool is incredible. Stunning views and sun loungers a plenty. \n\nAlso location is stunning, right next to shopping mall. \n\nWe will definitely be staying here again. \n\nThis hotel gets my top recommendation!",
            "time" : 1563270678
         },
         {
            "author_name" : "Tamim Kashgari",
            "author_url" : "https://www.google.com/maps/contrib/103837950757096482784/reviews",
            "language" : "en",
            "profile_photo_url" : "https://lh3.googleusercontent.com/a-/AAuE7mARnfuQE5TM7l9zaTCvmEZMYYRxPRK6nDJZf8f3=s128-c0x00000000-cc-rp-mo-ba5",
            "rating" : 5,
            "relative_time_description" : "3 weeks ago",
            "text" : "Stayed here on the tail end of a trip across Singapore and Malaysia. The hotels locations is excellent, it's close to so many sites in the KL, the draw back being that it's super far from the airport. The hotel also has some great food options and they serve a tremendous breakfast. The executive lounge also has a great daily offering between 5pm to 7pm.",
            "time" : 1567032301
         },
         {
            "author_name" : "Justin Yap",
            "author_url" : "https://www.google.com/maps/contrib/106691069749025460439/reviews",
            "language" : "en",
            "profile_photo_url" : "https://lh3.googleusercontent.com/-oSpPg243E6U/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rdNidGcFF5XkT4I50oyssxClGv09A/s128-c0x00000000-cc-rp-mo-ba4/photo.jpg",
            "rating" : 5,
            "relative_time_description" : "a month ago",
            "text" : "This is indeed one of the best hotel ballroom in Kuala Lumpur! Their setup and service is fabulous! They have people opening the door and greet you when you go up the escalate every single time! Love it so much!",
            "time" : 1564155739
         },
         {
            "author_name" : "jared lee",
            "author_url" : "https://www.google.com/maps/contrib/100092632282853602444/reviews",
            "language" : "en",
            "profile_photo_url" : "https://lh3.googleusercontent.com/a-/AAuE7mAVSbmvLMz9Ek4MWqm0INlWuV71XeVIUFhGoRRiAg=s128-c0x00000000-cc-rp-mo-ba6",
            "rating" : 5,
            "relative_time_description" : "2 months ago",
            "text" : "A very posh and high end hotel!! Came over here for few meetings and impressed by the ambience. Bright and sparkling clean place and well mannered and friendly staff all around. And my best compliments to the guys/gals at the reception, who are always courteous and knowledgeable on questions asked. \nGreat place and highly professional staff.",
            "time" : 1563026667
         },
         {
            "author_name" : "Dee Kuusik",
            "author_url" : "https://www.google.com/maps/contrib/108598808205403350683/reviews",
            "language" : "en",
            "profile_photo_url" : "https://lh4.googleusercontent.com/-R6f4t6Ar3d0/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rf52kJSdP3cyphPxkYHZsQ8pRQNXg/s128-c0x00000000-cc-rp-mo/photo.jpg",
            "rating" : 5,
            "relative_time_description" : "a month ago",
            "text" : "My partner and I a stayed at this hotel for 4 nights, and it was amazing. The service was incredible and the food was flawless. I am definitely looking forward too returning to this hotel in the future. We got a tower/park view (corner room) and it was perfect, to look out upon. The pool area is breath taking and they also have the golf that one plays  on the screen!..  also the buffet is a must, it was by far the best buffet I have been too. This hotel is definitely worth trying once.\nThe only thing I didn’t like was having to leave.. haha",
            "time" : 1565261441
         }
      ],
      "user_ratings_total" : 4143,
      "vicinity" : "Kuala Lumpur City Centre, Kuala Lumpur"
   },
   "status" : "OK"
}

См. Это изображение: Google Places API - Параметры поля

На изображении выше мы не можем найти правильный "field "параметры для:
1) 5-звездочный отель (рейтинг отеля) / например: JW Marriot Hotel - это 5-звездочный отель
2) Основные моменты
3) Удобства

Надеждачтобы получить более четкое объяснение того, как правильно настроить API Google Адресов, чтобы показывать нашим пользователям полную информацию об отеле (жилье).Любая помощь будет принята с благодарностью.

Спасибо за любезную помощь и желаю вам хорошего дня, ребята.

...