Skip to main content

Yelp api via Coldfusion and oAuth

What should have been a fairly easy implementation turned into several frustrating hours. I was using the old Yelp API that is accessed simply by passing your yelp key in the url. But, I wanted to take advantage of some of the new functionality only available in their API version 2.0. Unfortunately Yelp API v2 requires an oAuth key/signature type access.

Having already written similar code to access the Amazon web services with a signature I thought this would be a simple as reusing some existing code. Man was I wrong. Turns out a "correctly" implemented version of oAuth is much less tolerant than AWS is. Simple things, such as what characters in the URL must be encoded, invalidated the Yelp signature.

After much searching and screwing around with various proposed implementations it became clear that the easiest and best implementation was to use the Java library provided by Yelp and simply access it from Coldfusion.

To make this process easier I've consolidated the base java functions and wrapped them in one easy to call class. You simply invoke it with your Yelp keys and it does all the dirty work. To make it work you need to download and place the 3 java JAR files in your Coldfusion java classpath (or add a class path via CF Administrator). and then call the code like this (replace the "..." key values with your actual key values:

cfset consumerKey = "...">
cfset consumerSecret = "...">
cfset token = "...">
cfset tokenSecret = "...">

cfset yelp = CreateObject("java", "com.northbrook.yelp.Yelp").init(consumerKey, consumerSecret, token, tokenSecret)>
cfset yelp.addQueryStringParameter("location", "Northbrook*IL")>
cfset yelp.addQueryStringParameter("limit", "25")>
cfset result = yelp.query()>

cfdump var = "#result#">


Download three JARS and a sample .CFM here:
https://docs.google.com/leaf?id=0B-wcv3xk3UO2NjI3MTI1NmYtMmI2Yy00NzQxLTlkNzEtN2Y4ZjVjYTk5MGRk&hl=en_US

https://docs.google.com/leaf?id=0B-wcv3xk3UO2NTIzNDg5MGUtM2ExMS00MTllLWJjYTItNTQ4M2U0NjQ4MTBh&hl=en_US

https://docs.google.com/leaf?id=0B-wcv3xk3UO2MmQzNDA0YzAtYzI1Yy00N2NjLWFmNmItNjk2YmJjMmFjMjZl&hl=en_US

https://docs.google.com/leaf?id=0B-wcv3xk3UO2ZTY0ZDI2MjMtNmVlNi00YzI5LTgxMDMtYTgyNjA4ODM0NjY4&hl=en_US

Popular posts from this blog

Antiminer S7 Issues and Diagnostics steps

Note, the instructions below are how I diagnosed the problem I describe.  I'm providing it here in case these steps help you narrow down your issue somewhere along the way. I have an Antminer S7 (batch 8) unit that has been giving me problems.  It worked fine for a week or so then started slowing down.  I could hear the fan slowing down and speeding up and if I checked the web GUI of the unit I could see that “chains” 1 and 3 often had very cool temperatures, as if they weren’t even running. It would then try to get those engaged again and it would speed up and then the cycle would repeat.  Eventually, over time, I’d get a high piercing alarm sound and at that point if I checked the GUI I’d see Xs in the ASIC display instead of Os (image below). Above is how it was typically running.  After a while an alarm would sound and it would look like below: PSU: The first things I tried were to swap power supplies with a working unit.  It’s...

IOTA - A Beginner's Guide to Why IOTA Matters

IOTA is not your typical cryptocurrency.  IOTA, which typically stands for the Internet Of Things is a completely new approach to managing a blockchain. Blockchain technology is what made coins like Bitcoin (BTC) possible.  BTC is just a coin that uses the blockchain technology.  As I've said many times before, the "real" invention here was coming up with a blockchain that works.  To show that it works they created BTC.  The success of BTC is a very good indication of how well blockchains can work. Blockchains are what provide the audit trail of each transaction.  It is what allows you to purchase a digital "product" and be assured that the product is authentic and that you are the only one who owns that particular product.  It is what allows us to use BTC as money because it protects against counterfeiting.  Blockchains do have their limitations, most notably transaction speed, and IOTA solves these limitations.  This is hugely impor...

Etherum on the Move...

Artwork by Steven Grundy What, more Crypto talk? Yes, sorry, more crypto talk, but I'll try to keep it short. Back on July 16th I said that I thought the bear market had ended that day and we were starting a new bull market. Only time will tell if I was right because we haven't had enough time to call it a bear market. But, in that time, Ethereum, the bellwether coin that we measure with, is already more than 50% from that date and 120%+ since June 16th (2022). There are a lot of coins that did better than that, but for a "safe" bet like Ethereum, that's a really nice move. But, it's not too late. Ethereum makes a change on September 26th that will dramatically improve it's capabilities. I think we are going to fairly quickly see ETH return it, and pass it's all time high of $4891.70, maybe even before the end of the year. Now there is always the chance that ETH, and all coins, will turn around and head back down for a test of the low of $876.54....