In my app user has a option to login to app through linkedin.after login i have to get user's connections. when i try to get users connections i am getting response as
{
"errorCode": 0,
"message": "Access to connections denied",
"requestId": "60A0DS1MZE",
"status": 403,
"timestamp": 1386682428799
}
Here is my code
-(void)GetConnectionsCall
{
NSURL *url = [NSURL URLWithString:@"http://api.linkedin.com/v1/people/~/connections"];
OAMutableURLRequest *request =
[[OAMutableURLRequest alloc] initWithURL:url
consumer:_oAuthLoginView.consumer
token:_oAuthLoginView.accessToken
callback:nil
signatureProvider:nil];
[request setValue:@"json" forHTTPHeaderField:@"x-li-format"];
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(connectionsApiCallResult:didFinish:)
didFailSelector:@selector(connectionsApiCallResult:didFail:)];
}
- (void)connectionsApiCallResult:(OAServiceTicket *)ticket didFinish:(NSData *)data
{
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(@"connectionsApiCallResult====%@",responseBody);
}
- (void)connectionsApiCallResult:(OAServiceTicket *)ticket didFail:(NSError *)error
{
NSLog(@"%@",[error description]);
}
See Question&Answers more detail:os