2017-10-09 87 views
0

我使用这个API请求获取使用Facebook Places API的所有FITNESS_RECREATION中心。如何把Facebook的地方过滤器图形API

https://graph.facebook.com/search?type=place&q=FITNESS_RECREATION&fields=name,location&limit=5&access_token=API_ID|SECRET_KEY

我试图做两件事情:1 )筛选和获取哪个国家=马来西亚的请求。 2)获得至少5000个退货清单。 Facebook似乎将响应限制为最多100个。有没有解决方法。

这是一个示例响应:

{ 
    "data": [ 
     { 
     "name": "Recreation Fitness", 
     "location": { 
      "city": "Long Beach", 
      "country": "United States", 
      "latitude": 33.833224817855, 
      "longitude": -118.1849527359, 
      "state": "CA", 
      "street": "4234 Atlantic Ave", 
      "zip": "90807" 
     }, 
     "id": "420888681274648" 
     }, 
     { 
     "name": "Extreme Fitness- West Coast Recreation", 
     "location": { 
      "city": "Singapore", 
      "country": "Singapore", 
      "latitude": 1.30975, 
      "longitude": 103.764183, 
      "street": "12 West Coast Walk \u0040 West Coast Recreation", 
      "zip": "127157" 
     }, 
     "id": "982344108463873" 
     }, 
     { 
     "name": "TMP Fitness Sports and Recreation Club", 
     "location": { 
      "city": "Singapore", 
      "country": "Singapore", 
      "latitude": 1.3196699, 
      "longitude": 103.84262, 
      "street": "55 Newton Road, #05-02 Revenue House", 
      "zip": "307987" 
     }, 
     "id": "336128976479984" 
     }, 
     { 
     "name": "Fitness First Platinum Trinoma", 
     "location": { 
      "city": "Quezon City", 
      "country": "Philippines", 
      "latitude": 14.654392396144, 
      "located_in": "322295778137", 
      "longitude": 121.03377838573, 
      "street": "North Ave" 
     }, 
     "id": "516897225075490" 
     }, 
     { 
     "name": "Launceston PCYC Weight Gym, Fitness & Recreation Centre", 
     "location": { 
      "city": "Newstead", 
      "country": "Australia", 
      "latitude": -41.44732, 
      "longitude": 147.15653, 
      "state": "TAS", 
      "street": "146 Abbott St", 
      "zip": "7250" 
     }, 
     "id": "169928146489153" 
     } 
    ], 
    "paging": { 
     "cursors": { 
     "after": "NAZDZD" 
     }, 
     "next": "https://graph.facebook.com/v2.10/search?access_token=737434766443796\u00257Cb10e3ea49284dc815b25910e6fb39aea&pretty=1&fields=name\u00252Clocation&q=FITNESS_RECREATION&type=place&limit=5&after=NAZDZD" 
    } 
} 
+0

尝试过使用这种格式来筛选国家=马来西亚: https://graph.facebook.com/search?type=place&q=FITNESS_RECREATION&fields=name,location{country=Malaysia}&limit=5000&access_token=APP_ID|secret_key 然而,得到了错误: { “错误”:{ “消息”: “(#100)试图在节点类型访问不存在的字段(国家=马来西亚)(位置)”, “类型” : “OAuthException”, “代码”:100, “fbtrace_id”: “DfofQreXq/8” } } –

回答

1

我试图做两件事情:1)筛选和获取哪个国家=马来西亚的请求。

不可能。

您可以搜索围绕给定地理位置的地方(使用centerdistance参数,请参见https://developers.facebook.com/docs/graph-api/using-graph-api/#search

也可以添加Malaysia到您正在搜索的name,以获得实际在全国的地方他们的名字。比

更多 - 不可能的。你必须在你的最后做额外的过滤。

2)要获得至少5000返回列表。 Facebook似乎将响应限制为最多100个。有没有解决方法。

没有,没有,这是一个故意的限制。您需要使用分页来获得更多结果。 https://developers.facebook.com/docs/graph-api/using-graph-api/#paging


仅供参考,如果不应该清楚:Facebook的提供搜索端点,让您的应用程序可以执行用户的名称进行搜索,一段特定的,他们可能需要的信息那时。这并不意味着作为一种方式,任何应用获取/“下载”了一套完整的针对特定搜索词来使用他们自己的目的的数据。