Yelp, my favorite local review site, launched a data API today.
I was half hoping that it would use the draft OpenSearch Geo extensions that Andrew has been working on, but after taking a look, the API is richer in scope than what the geo extension is designed for. Though as you can see below, the geo extensions could still offer a complement to the Yelp API.
Moreover, Yelp made the perfectly reasonable choice to syndicate their search results in a JSON format (example), rather than with a more bulky XML document.
Which gets me again thinking about documenting a JSON-based output format for OpenSearch results. Given OpenSearch’s agnostic relationship with syndication formats, and my own long-standing assertion that XML is merely one serialization possibility for Atom, there is nothing really stopping us from adopting JSON+OpenSearch.
In fact, here’s what an OpenSearch description document might look like for a simple (i.e., not comprehensive) Yelp search request:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:yelp="http://www.yelp.com/developers/documentation/search_api">
<ShortName>Yelp Search</ShortName>
<Description>Use Yelp.com to search local businesses.</Description>
<Tags>yelp</Tags>
<Contact>admin@example.com</Contact>
<Url type="application/json"
template="http://api.yelp.com/business_review_search?term={searchTerms}&tl_lat={yelp:tllat}&tl_long={yelp:tllong}&br_lat={yelp:brlat}&br_long={yelp:brlong}&num_biz_requested={count}&ywsid={yelp:ywsid}"/>
</OpenSearchDescription>
Or even more fun, one that tweaks the Yelp API a bit to support the OpenSearch Geo notion of bounding boxes instead of explicit corners:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:geo="http://a9.com/-/opensearch/extensions/geo/1.0/"
xmlns:yelp="http://www.yelp.com/developers/documentation/search_api">
<ShortName>Yelp Search</ShortName>
<Description>Use Yelp.com to search local businesses.</Description>
<Tags>yelp</Tags>
<Contact>admin@example.com</Contact>
<Url type="application/json"
template="http://api.yelp.com/business_review_search?term={searchTerms}&box={geo:box}&ywsid={yelp:ywsid}"/>
</OpenSearchDescription>
Nice.
…
Somewhere out there is a complete version of a OpenSearch+Local spec I wrote for the old A9 local search engine… I wonder if anyone still has it; it might be worth digging up. Of course, that version used a payload of XHTML+microformats, which had some neat properties of its own.
In any case, the Yelp API is very cool. I hope to see some amazing apps built around an already fantastic service!
…
Update: Fixed a grammar error.

August 3rd, 2007 at 8:49 am
[...] DeWitt Clinton » Blog Archive » Yelp search API – yesterday I decided I didn’t have the time to read through the whole Yelp spec and make my suggestions on how they be using OpenSearch. So naturally, DeWitt (independently) did exactly that. [...]
August 4th, 2007 at 7:27 am
I wrote a little search engine and have enabled an api for it at futef.com – I have a small number of folks using the api and have always been interested in adding open search support. Surprisingly, no one ever asked for it – in fact only one person even asked for XML but my numbers are small and probably not very representative. Anyway, JSON is the result format so I am interested in where this might go. Additionally, I interested in the best way to expand open search to included faceted navigation.
August 4th, 2007 at 9:21 am
Hey Derek,
I just checked out http://futef.com/ and http://api.futef.com/apidocs.html. Nice work!
I’m not that surprised about people not explicitly asking for OpenSearch XML unless you have a lot of syndication partners. It’s a good option for people that want to pick something remotely standard as a starting point to save themselves some time making hard design choices in a search API. Also, it’s nice in that there are client libraries available in many programming languages.
Your API would definitely be a candidate for an OpenSearch description document if we figure out a formal JSON serialization model. Let’s keep working on this!
What exactly did you mean by “faceted navigation” btw?
August 5th, 2007 at 6:35 pm
Yeah, open search is great but it is hard to convince people that it is of interest – if google or yahoo would agree becoming open search enabled – then lots of people would probably jump on the bandwagon.
“faceted navigation” – is it the little categories on the side that allow for narrowing. It is typically seen in e-commerce sites that allow for narrowing or navigate by different facets (price, color, size, maker, etc). It is powerful but has UI issues that are far beyond me. http://en.wikipedia.org/wiki/Faceted_classification – Anyway I am on the mailing list so feel free to move the discussion there.
August 6th, 2007 at 11:10 am
Hi DeWitt -
I was excited as you to hear about this api :)
Not sure if you’re into this kind of thing, but I put together an iPhone app utilizing the business search. Just one weekend’s worth of work, so it’s still a little rough, but definitely ready for testing:
http://iyelp.net
August 6th, 2007 at 2:14 pm
Derek,
Do you really think that OpenSearch enabling the output of Yahoo’s Search API would make a difference? If so, maybe I’ll hack that code up in the near future…
I made the argument here quite some time back, but times have changed since then and I’m not sure what A9 is up to anymore, especially since Udi and DeWitt both left.
August 7th, 2007 at 9:33 am
Jeremey,
I actually do think it would make a big difference. I work at a large old institution and we do sit around in meetings and talk lovingly about what do yahoo and google. We actually implemented Opensearch w/ A9 long ago – no one cared. Perhaps the times have changed and with Yahoo backing this things would be different. Personally, I would like to see a JSON version – heck the futef api was modeled after yahoo’s sweet json apis. From Google I would love to see CSE/Coop with an opensearch json api. Bonus points if they figure out a way to merge in the One box stuff.
August 16th, 2007 at 11:20 am
Leaked U.S News. 2008 Liberal Arts College Rankings…
U.S. News rankings come out tomorrow. An anonymous commentator claims that Williams is still #1. The rankings have supposedly been leaked. Here are the top LACs: 1. Williams 2. Amherst 3. Swarthmore 4. Wellesley 5. Carleton … True? I think……
August 18th, 2007 at 11:17 pm
Testing an OpenID signed comment.