5

I'm hooking into the yelp 2.0 Api and I'm wondering if there is a way to retrieve the list of categories and sub categories. I know that the list is available here http://www.yelp.com/developers/documentation/category_list but there doesn't seem to be a way to retrieve it. I'd like to have a source to retrieve it from so that it's not hard coded in my application and will stay up to date.

RAS
  • 7,807
  • 15
  • 61
  • 81
Jeff Schmitz
  • 1,007
  • 1
  • 13
  • 27

2 Answers2

12

Here is a link to all of the categories in json format: https://raw.github.com/Yelp/yelp-api/master/category_lists/en/category.json

You can programmaticaly download this. The good thing about page is that it gives the categories as they exist in the Yelp ontology.

[Edit] Now you can get the json of all categories from all countries:

https://www.yelp.com/developers/documentation/v2/all_category_list/categories.json

bad news, it's not sorted by country, it's all of them

Justin Harris
  • 1,362
  • 17
  • 23
  • Thanks, this is the best option I've seen. – Jeff Schmitz Jul 30 '12 at 20:11
  • 1
    It is worth noting the the categories depend on your region. The complete list can be found [here](http://www.yelp.ca/developers/documentation/all_category_list). The json versions for certain countries are [here](https://github.com/Yelp/yelp-api/tree/master/category_lists) – Justin Harris Nov 13 '12 at 01:30
  • 1
    I have the impression that only the categories that are available in the US can be used with the category_filter. For all non-US categories I tested, I get an INVALID_PARAMETER error. Do I have to use a different server? Or is this a bug in the API? – Futzilogik Mar 13 '13 at 23:24
  • We also had the same problems with non US categories. Did you try changing the address to yelp.ca (for Canada) or yelp.co.uk (for the UK)? Since for example, the API docs for UK are at [yelp.co.uk](http://www.yelp.co.uk/developers/documentation/category_list). – Justin Harris Mar 20 '13 at 13:54
  • Excellent, was just looking for this. – thandasoru Sep 05 '14 at 05:19
1

I know you won't like it but I recommend not to use json from github and parse this html page instead.

As of writing json from accepted answer is 11 months old. It's missing many categories. To name few:

gift shops
shanghainese
cantonese
food trucks
beer
wine & spirits
bubble tea
puerto rican
resorts

Also note that there is discrepancy between categories from this html list, json from git hub and actual value used on web-page of each business in regards to visualization of word and. In some cases it's wine & spirits and in others it's wine and spirits. Be careful with it.

PS. I'm not (yet) a Scala guru but here is how I parse the HTML

expert
  • 26,897
  • 27
  • 105
  • 198