How to search nearby Facebook pages/places based on specific categories?

Viewed 146

There is the Place Search for Android which allows filtering based on category:

  1. addCategory() has 8 high-level categories:

    Param categories[0] must be one of {EDUCATION, FOOD_BEVERAGE, HOTEL_LODGING, MEDICAL_HEALTH, ARTS_ENTERTAINMENT, SHOPPING_RETAIL, FITNESS_RECREATION, TRAVEL_TRANSPORTATION}

However I need a web API (not Android). I've tried the following web API:

https://graph.facebook.com/search?distance=1000&center=-37.756180,145.151895&type=place&fields=id,name,category_list,location&limit=20&access_token=****

which returns the following:

enter image description here

but I'm not sure how I can filter these results based on their category. For example, I don't want to return suburbs. I want to return certain types of places such as restaurants, banks etc. However adding &category=133576170041936 (that's the ID for the BANK category) won't filter the results.

Adding &category=FOOD_BEVERAGE also does nothing.

Is there another way to filter the results based on category.?

1 Answers

You can't search for pages using the search API - it has been deprecated.

See: https://developers.facebook.com/blog/post/2018/04/04/facebook-api-platform-product-changes/

And: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4

Search API

Deprecated: Support for finding pages, groups, events, users using search.

However I believe you can search for places using the categories (not category as you have) parameter. e.g.

https://graph.facebook.com/search?categories=["FOOD_BEVERAGE"]...

I also believe (could be wrong) you can supply multiple categories e.g.

https://graph.facebook.com/search?categories=["FOOD_BEVERAGE", "HOTEL_LODGING"]...

That is the list type like categories is specified in JSON syntax, for example: ["firstitem", "seconditem", "thirditem"]

Related