6

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?

djblue2009
  • 1,344
  • 17
  • 23

1 Answers1

1

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

dmason82
  • 409
  • 6
  • 5
  • I'm using AFNetworking and just converting the URL from my question as an NSURL. – djblue2009 Nov 30 '12 at 22:35
  • not a terribly helpful example. outdated ARC and no storyboard, no clear indication of where to place provided CONSUMER_KEY or TOKEN – tarabyte Feb 07 '14 at 23:27
  • The CONSUMER_KEY and TOKEN are placed in the OAuthTest.m file as a part of the developer building the OAuth consumer client https://github.com/Yelp/yelp-api/blob/3a2d59cf454f1053f63521f51a9d9e1da04b0698/v2/ios/YelpAPI/Tests/OAuthTest.m granted, yes, this is ancient Objective-C, however, Yelp is still using OAuth 1.0a, which makes updated libraries somewhat of a problem. – dmason82 Feb 24 '14 at 05:40