Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Use the <a href="http://www.yelp.com/developers/documentation/v2/search_api" rel="nofollow">search API</a> instead, and set a <code>category_filter</code> according to <a href="http://www.yelp.com/developers/documentation/category_list" rel="nofollow">this list</a>.<br> This should give you all the "objects" in the given category.</p> <p>Something like this <code>http://api.yelp.com/v2/search?category_filter=restaurants</code>.</p> <hr> <p><strong>Update</strong></p> <p>It seems like I misunderstood a little... so you want to get the root category.<br> (eg. for "italian"–>"restaurants", "french"->restaurants, "car dealers"->automotive etc.)</p> <p>I think you have two options:</p> <ol> <li>Hardcode the dictionary of all restaurant subcategories (french,italian...) into a file (plist, json, whatever) and after getting the "object" you could check if the subcategory is included in the hard-coded subcategories dictionary.</li> <li>Use the search API and provide the bussiness <code>id</code> and <code>category_filter</code> set to restaurants and check if it returns any result - if not, then the object is not in the right category.</li> </ol> <p>The reason why I am suggesting to hard code it is, because Yelp doesn't provide an API to get complete list of categories.</p> <p>In my opinion I would try the approach #1, because it is less intensive on the network side and a dictionary is blazing fast.</p> <p>But to answer your initial question, no it is not possible to have the root category in the JSON file.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload