Foursquare不会从搜索中返回所有属性

时间:2018-01-26 20:50:34

标签: javascript http get foursquare

我正在使用

向Foursquare提出请求
$sp

试图获得"价格"属性。但是,它似乎没有返回此文档页面详细列出的所有列出的属性。

https://developer.foursquare.com/docs/api/venues/search

这是我收到的对象:

GET https://api.foursquare.com/v2/venues/search 

如您所见,price属性(以及其他一些属性)不是响应对象的一部分。这些也是我用来进行搜索的参数:

   id: '4c93ae9594a0236aea808512',
   name: 'China Garden',
   contact: {},
   location: [Object],
   categories: [Array],
   verified: false,
   stats: [Object],
   hasMenu: true,
   menu: [Object],
   allowMenuUrlEdit: true,
   beenHere: [Object],
   specials: [Object],
   referralId: 'v-1516988384',
   venueChains: [],
   hasPerk: false 

有人知道为什么这些是唯一返回的属性吗?

1 个答案:

答案 0 :(得分:0)

有一个新的/search/recommendations endpoint听起来会像你想要的那样。

首先,它允许查询nearcategoryIdlimitlocalTimelocalDay等参数。

响应中包含price等。

以下是回复的示例:



[{
  "displayType": "venue",
  "venue": {
    "id": "4fa445c8e4b0baf7cc71e811",
    "name": "Boudoir",
    "contact": {
      "phone": "+441382225968",
      "formattedPhone": "+44 1382 225968"
    },
    "location": {
      "address": "1 Temple Lane",
      "lat": 56.459587391243105,
      "lng": -2.978718040375153,
      "labeledLatLngs": [{
        "label": "display",
        "lat": 56.459587391243105,
        "lng": -2.978718040375153
      }],
      "postalCode": "DD1 4HA",
      "cc": "GB",
      "city": "Dundee",
      "state": "Dundee City",
      "country": "United Kingdom",
      "formattedAddress": [
        "1 Temple Lane",
        "Dundee",
        "Dundee City",
        "DD1 4HA",
        "United Kingdom"
      ]
    },
    "categories": [{
      "id": "4bf58dd8d48988d146941735",
      "name": "Deli / Bodega",
      "pluralName": "Delis / Bodegas",
      "shortName": "Deli / Bodega",
      "icon": {
        "prefix": "https://ss3.4sqi.net/img/categories_v2/food/deli_",
        "suffix": ".png"
      },
      "primary": true
    }],
    "verified": false,
    "stats": {
      "checkinsCount": 73,
      "usersCount": 46,
      "tipCount": 0
    },
    "url": "http://www.boudoir.wickedweb.biz",
    "price": {
      "tier": 3,
      "message": "Expensive",
      "currency": "£"
    },
    "dislike": false,
    "ok": false,
    "allowMenuUrlEdit": true,
    "beenHere": {
      "count": 0,
      "marked": false,
      "lastCheckinExpiredAt": 0
    }
  },
  "id": "5a86bea63b830731dbaff394",
  "photo": {
    "id": "51d8959a498ebc1f8cfe6ca1",
    "createdAt": 1373148570,
    "prefix": "https://igx.4sqi.net/img/general/",
    "suffix": "/2773213_EBnYq-AmD-arj7VH3pP47B7HMi1lP2LYdb76CSsJJ9o.jpg",
    "width": 720,
    "height": 960,
    "visibility": "public"
  },
  "snippets": {
    "count": 1,
    "items": [{}]
  }
}]