I am working on Yelp integration in my app and I am using this demo as a reference.
When I am searching @"restaurants"
it works well, but when I am searching @"Shopping"
it gives this response:
{ status code: 400, headers {
"Cache-Control" = private;
"Content-Length" = 123;
"Content-Type" = "application/json; charset=UTF-8";
Date = "Mon, 06 Jul 2015 10:28:37 GMT";
Server = Apache;
Vary = "User-Agent";
"X-Mode" = ro;
"X-Node" = "web16-uswest1bprod, api_com";
"X-Proxied" = "extlb1-uswest1bprod";
} }
My .m file code:
- (OAMutableURLRequest*) getOARequest {
NSString *realm;
OAConsumer *consumer = [[OAConsumer alloc] initWithKey: CONSUMER_KEY secret: CONSUMER_SECRET];
//passing token and token secret keys.
OAToken *token = [[OAToken alloc] initWithKey: TOKEN secret: TOKEN_SECRET];
id<OASignatureProviding, NSObject> provider = [[OAHMAC_SHA1SignatureProvider alloc] init];
//calling signature method
OAMutableURLRequest* request = [[OAMutableURLRequest alloc]
initWithURL: [NSURL URLWithString:[self getRequestURLString]]
consumer: consumer
token: token
realm: realm
signatureProvider: provider];
[request prepare];
return request;
}
- (void) getRestaurantList {
NSHTTPURLResponse* response; //this is object is used for response perpose
NSError* error;
NSData* data = [NSURLConnection sendSynchronousRequest: [self getOARequest]
returningResponse: &response
error: &error];
// If the response is all good then fill in the restaurant dictionary with
// the Yelp JSON data
NSLog(@"%@",response);
if ([response statusCode] == 200) {
//success
}
Does anyone know what is the problem in the Yelp API?