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:
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
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
Can you add the full code for cfm page please.
ReplyDeleteThanks for this Steve - Saved me heaps of time
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteNice Article...
ReplyDeletequickbooks enterprise support phone number
Much thanks for composing such an intriguing article on this point. This has truly made me think and I plan to peruse more. Buy Yelp Reviews Cheap
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThe sponsored posts are linked to the user’s profile, where another user can decide to be a follower.
ReplyDeleteGood Site For Twitter Followers
One of the finest things around buy Twitter followers is the astonishing kind of authority that derives along. It’s hard to construct power on Twitter, mainly when you merely have 35 follower. This is wherever purchasing Twitter followers could be extremely operative.Good Site For Twitter Followers
ReplyDeleteOur company has a highly experienced team of experts who’ve designed a very simple procedure for you to purchase Google Reviews. Now Buying Google Reviews is not a hard job anymore. Everyone can Buy Google Reviews with us. Buy Google Business Reviews
ReplyDeleteGoogle reviews can either be positive or negative for your business, stores, office, restaurant, service or requirements. Google is the largest search engine, as well as the most efficient advertisement website.Buy Google Reviews
ReplyDeleteInvestigation displays that online reviews drive additional sales than customary marketing means for example social media, advertising, as well as organic search results. Buy Google Reviews
ReplyDeleteGoogle allows users to write reviews directly on the business’s Google or Google map listing. Since Google reviews are obviously favored by the search engine and show up upon every relevant result, the best place to start a business firm is getting involved with Google Reviews.Buy Google Maps Reviews
ReplyDeleteThere are numerous web sites online that are providing this provision service. We are amongst these web sites that offer the best plus most reasonable discounts that would certainly offer value to your money.Buy SoundCloud Plays
ReplyDeleteThe key features of this service are that all page reposts are permanent). Second, you’ll get 100% satisfaction assurances. The service delivery time is 10 hours. No programs, bots, or software are used in this service. When you buy this service, it’s a 100 %stable and safe account, with real high-class campaigns as well as 100 % safety and security, as well as customer satisfaction. With this service, you’ll save time and effort. You’ll experience improvements within 24 hours.Buy SoundCloud Plays Cheap
ReplyDeleteThe key features of this service are that all page reposts are permanent). Second, you’ll get 100% satisfaction assurances. The service delivery time is 10 hours. No programs, bots, or software are used in this service. When you buy this service, it’s a 100 %stable and safe account, with real high-class campaigns as well as 100 % safety and security, as well as customer satisfaction. With this service, you’ll save time and effort. You’ll experience improvements within 24 hours.Buy SoundCloud Plays Cheap
ReplyDeleteThere is nothing like using application software which is also the programs which do the real job in the computer system. Buy Google Reviews Cheap
ReplyDeleteMangocity IT Much thanks for composing such an intriguing article on this point. This has truly made me think and I plan to peruse more. Buy Yelp Reviews Cheap
ReplyDeleteTop Promoter This is really a nice and informative, containing all information and also has a great impact on the new technology. Check it out here: Linkedin Promotion
ReplyDeleteTop SEO Work Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Facebook Reviews
ReplyDeleteThanks for this article very helpful. thanks. Buy Google Reviews Netherlands
ReplyDeleteI read that Post and got it fine and enlightening. If you don't mind share more like that... Buy Trustpilot Reviews
ReplyDeleteBuy Soundcloud Service
ReplyDeleteThis is my first time i visit here. I discovered such a large number of fascinating stuff in your online journal particularly its dialog. From the huge amounts of remarks on your articles, I figure I am by all account not the only one having all the satisfaction here! keep doing awesome how important are google reviews