Not So Liberated Yelp API

Recently, I wanted to develop a mobile app that displayed a walking city tour of your bookmarked places on Yelp so that if you are in a new city and want waypoints generated for the nearest favorite locations, you can quickly get them on the fly. This was harder than I thought because of the limitations of the Yelp API.

I wanted to produce a final solution all Node JS and Angular JS. This meant learning about Node JS, Angular JS and how to wire the two together. The implementation would utilize Google Maps and Geocoding services. I ran into several limitations with their free service, mostly OVER_QUERY_LIMIT errors which would require me to rewrite my code to handle these errors, wait a few seconds and then retry.

The NodeJS server returns some JSON with bookmarked locations which were queried directly from a Yelp URL using request and then parsed with cherrio. The reason I couldn’t use their API is that they did not include retrieving bookmarks!

[{title: "Pyramid Alehouse",
streetAddress: "1201 1st Ave S Seattle, WA 98134"
},{title: "Elysian Fields",
streetAddress: "542 1st Ave S Seattle, WA 98104"
},{title: "The Brooklyn Seafood, Steak & Oyster House",
streetAddress: "1212 2nd Ave Seattle, WA 98101"}]

The results were a list of waypoints starting from the user’s location.

2014-07-18_14-25-48

Unfortunately, after deploying the site to OpenShift, I encountered rejects from Yelp. Even after trying several popular proxies, Yelp would not let me call their site.

2014-07-18_13-21-59

Therefore, I sent an plea to Yelp, suggesting they open their API a bit more:

“I am a avid user of Yelp and an active reviewer. I am also a developer and would like to write a mobile app that integrated with Yelp. However, I’ve found the Yelp API to be limiting. For example, I cannot query a list of my bookmarks for a particular city. I plan on displaying these bookmarks on a Google map with waypoints indicating the ideal path to take from my starting point. This way, I can create a walking tour of my favorite Yelp bookmarks within walking distance from me. This appears to be an important feature which Yelp currently lacks. Upon discovery, I’ve found that I cannot even query my open public bookmarks from my web server as I get a 403: Forbidden error. Is there a legal reason for rejecting my server request? Please add the ability to query bookmarks from the API or provide a way I can get a list of bookmarks from a url such as “http://www.yelp.com/user_details_bookmarks?cc=US&city=Seattle&state=WA&userid=XXX&neighborhood=Downtown” from my web server without getting blocked.”

If you’re curious, you can find the implemtation here: https://github.com/szahn/YelpItinerary. It’s not finished yet and there is still a ton of refactoring to do.

Advertisements

Recent Finds on the Web

Refresher on numbers and a breakdown of their representation in computer code and how to do bitwise operators on them. “A number is a very abstract concept. Unlike physical objects, which are easily recognizable on sight, a number can be represented in an infinite number of ways. The representation we are used to is called decimal, or base 10. The first time is pretty familiar, but if you’re reading this section, the second term may be new to you. To see why we use the term “base 10,” let’s take a look at an arbitrary number, say 5346. Read aloud, this is five thousand, three hundred, forty-six. We hear numbers like that so often that it’s not immediately obvious, but this sounds a lot like a formula. Specifically: 5346 = (5 * 1000) + (3 * 100) + (4 * 10) + (6 * 1)
Or, if we write it another way, we see that a decimal number is actually the sum of its digits multiplied by successive powers of 10: 5346 = (5 * 103) + (3 * 102) + (4 * 101) + (6 * 100)
Do you see why the term “base 10” is used to describe the way we normally write numbers? Any integer can be written this way. Suppose we call the least significant digit (the digit in the ones place) “digit 0,” and each successively higher digit is digit 1, digit 2, and so on. Then the full
number is represented by digit 0 times 100, plus digit 1 times 101, and so on, up through digit n times 10n.”

If you love numbers and math and want a quick refresher, check out the “30-Second Maths” eBook.