如何使用zomato API获取菜单的所有页面?

时间:2017-05-14 14:55:45

标签: api zomato-api

我在我的应用程序中使用Zomato API。我在以下地区查询了一家餐馆

https://developers.zomato.com/api/v2.1/restaurant?res_id=RESID

我收到了餐馆数据的JSON回复。像

{
  "id": "16774318",
  "name": "Otto Enoteca & Pizzeria",
  "url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village",
  "location": {
    "address": "1 5th Avenue, New York, NY 10003",
    "locality": "Greenwich Village",
    "city": "New York City",
    "latitude": "40.732013",
    "longitude": "-73.996155",
    "zipcode": "10003",
    "country_id": "216"
  },
  "average_cost_for_two": "60",
  "price_range": "2",
  "currency": "$",
  "thumb": "https://b.zmtcdn.com/data/pictures/chains/8/16774318/a54deb9e4dbb79dd7c8091b30c642077_featured_thumb.png",
  "featured_image": "https://d.zmtcdn.com/data/pictures/chains/8/16774318/a54deb9e4dbb79dd7c8091b30c642077_featured_v2.png",
  "photos_url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village/photos#tabtop",
  "menu_url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village/menu#tabtop",
  "events_url": "https://www.zomato.com/new-york-city/otto-enoteca-pizzeria-greenwich-village/events#tabtop",
  "user_rating": {
    "aggregate_rating": "3.7",
    "rating_text": "Very Good",
    "rating_color": "5BA829",
    "votes": "1046"
  },
  "has_online_delivery": "0",
  "is_delivering_now": "0",
  "has_table_booking": "0",
  "deeplink": "zomato://r/16774318",
  "cuisines": "Cafe",
  "all_reviews_count": "15",
  "photo_count": "18",
  "phone_numbers": "(212) 228-2930",
  "photos": [
    {
      "id": "u_MjA5MjY1OTk5OT",
      "url": "https://b.zmtcdn.com/data/reviews_photos/c15/9eb13ceaf6e90129c276ce6ff980bc15_1435111695_640_640_thumb.JPG",
      "thumb_url": "https://b.zmtcdn.com/data/reviews_photos/c15/9eb13ceaf6e90129c276ce6ff980bc15_1435111695_200_thumb.JPG",
      "user": {
        "name": "John Doe",
        "zomato_handle": "John",
        "foodie_level": "Super Foodie",
        "foodie_level_num": "9",
        "foodie_color": "f58552",
        "profile_url": "https://www.zomato.com/john",
        "profile_deeplink": "zoma.to/u/1170245",
        "profile_image": "string"
      },
      "res_id": "16782899",
      "caption": "#awesome",
      "timestamp": "1435111770",
      "friendly_time": "3 months ago",
      "width": "640",
      "height": "640",
      "comments_count": "0",
      "likes_count": "0"
    }
  ],
  "all_reviews": [
    {
      "rating": "5",
      "review_text": "The best latte I've ever had. It tasted a little sweet",
      "id": "24127336",
      "rating_color": "305D02",
      "review_time_friendly": "2 months ago",
      "rating_text": "Insane!",
      "timestamp": "1435507367",
      "likes": "0",
      "user": {
        "name": "John Doe",
        "zomato_handle": "John",
        "foodie_level": "Super Foodie",
        "foodie_level_num": "9",
        "foodie_color": "f58552",
        "profile_url": "https://www.zomato.com/john",
        "profile_deeplink": "zoma.to/u/1170245",
        "profile_image": "string"
      },
      "comments_count": "0"
    }
      ]
}

它提供了一个类似

的菜单网址

https://www.zomato.com/chennai/RESTAURANT_NAME/menu?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1&openSwipeBox=menu&showMinimal=1#tabtop

但是这个网址会返回整个网页,该网页是该餐厅的zomato菜单列表的第一张图片。

我想单独的餐厅菜单照片(菜单的所有页面)。 同样对于照片也是如此。

PS:请不要在这里建议网络疤痕。 是否有直接获取这些的API?

Zomato API guide

谢谢!

1 个答案:

答案 0 :(得分:1)

有关您的信息,餐厅的菜单照片可通过Zomato API获得。也许,列表的菜单页面网址是最接近您的情况可能有用的选项。

就餐厅的照片而言,它们仅限于选定的API合作伙伴。最多,您可以访问餐馆缩略图。

看看这是否能解答您的疑问:)