Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Yelp API request?

I am just trying to make a Yelp API request as part of an iPhone app and I don't know how to set up the request. I have all of my authentication keys via Yelp, but I'm not sure what all I need to include. I don't need to have users sign in to their account or anything, I just want to be able to retrieve reviews to display in my app.

Say I want to the search term=food in location=San Francisco. My initial thought is to do:

http://api.yelp.com/v2/search?term=food&location=San+Francisco&oauth_consumer_key=XXXXXXX&oauth_nonce=XXXXX&oauth_signature=XXXXXX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=XXXXX&oauth_token=XXXX

when I try this I get an INVALID_SIGNATURE error

What is the best way to request this information from Yelp? Also, am I supposed to pass my authentication keys via the URL?

like image 808
djblue2009 Avatar asked Nov 30 '12 22:11

djblue2009


People also ask

What can the Yelp API do?

The Yelp API provides data from millions of businesses across the world. It contains data such as business ratings, reviews, locations, photos, and a plethora of other details. In this guide, you will learn everything you need to know to set up your own Yelp account and how to make requests with the Yelp API.

How do you get data from Yelp?

You can make a request through Yelp's data download tool as described below: Desktop: Go to your Privacy Settings and click on the link to Download a copy of your Yelp data in the upper right corner of the page.


1 Answers

How are you doing the request out of curiosity? Yelp does have an example library for getting requests on iOS at: https://github.com/Yelp/yelp-api/tree/master/v2/ios/YelpAPI If you wanted an example of how they do API requests.

Edit: I did a download of Yelp's iOS project, and actually took the OAuth library and YAJL framework into a test XCode account with ARC and Storyboards, however I did have to add -fno-objc-arc to each of the OAuthConsumer libraries. After that process, the following code works after you import the OAuthConsumer.h file: I created a gist, since the code tag wasn't quite happy with how my code was formatted.

https://gist.github.com/dmason82/9200614

like image 165
dmason82 Avatar answered Oct 05 '22 02:10

dmason82