I am trying to call the Stack Exchange API to get a list of users. This is from my iOS app:
NSString *str=[NSString stringWithFormat:@"http://stackexchange.com/oauth/2.2/users?order=desc&sort=reputation&site=stackoverflow&Client_Id=5029"]];
NSURL *url = [NSURL URLWithString:str];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response,
NSData *data, NSError *connectionError)
{
if (data.length > 0 && connectionError == nil)
{
NSDictionary *greeting = [NSJSONSerialization JSONObjectWithData:data
options:0
error:NULL];
}
}];
What is wrong with the call? I did not get list of users. It gives an HTML response.
I want to show a list of users from Stack Overflow.