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

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.


1 Answer 1


I am not familiar with iOS programming but it seems your end point is invalid. As a result you will get "page not found" HTML response.

Instead of using http://stackexchange.com/oauth/2.2/users?order=desc&sort=reputation&site=stackoverflow&Client_Id=5029, try to use https://api.stackexchange.com/2.2/users?order=desc&sort=reputation&site=stackoverflow&Client_Id=5029 and you will get the list of users.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .