1

In my app I want to show the Twitter followers list. I've tried accomplishing this using the following code:

NSString *urlstring = [NSString stringWithFormat:
    @"https://api.twitter.com/1/followers.json?screen_name=%@", username];

NSURL *url = [[NSURL alloc]initWithString:urlstring];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request startSynchronous];

But I get only 20 followers returned (from an account that has 1045 followers). So I tried:

NSString *urlstring = [NSString stringWithFormat:
    @"https://api.twitter.com/1/followers.json?cursor=-1&screen_name=%@&count=10000",
    username];

NSURL *url = [[NSURL alloc]initWithString:urlstring];

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request startSynchronous];

Now I am getting 200 followers, which is still not the correct total. Is there a restriction on the Twitter API which would prevent me from getting the total number of followers in one call? Or could this issue be due to something else? All suggestions on how to fix this problem are welcome.

Thanks in advance!!

Perception
  • 79,279
  • 19
  • 185
  • 195
Krish Allamraju
  • 703
  • 1
  • 7
  • 29

1 Answers1

3

From Twitter Docs

"Version 1 of the REST API is now deprecated and will cease functioning in the coming months. Migrate to version 1.1 today."

and according to Twitter API 1.1

You should use https://dev.twitter.com/docs/api/1.1/get/followers/list API call and

"At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests."

Peter Pajchl
  • 2,699
  • 21
  • 24
  • 1
    Pajchi i tried https://api.twitter.com/1.1/followers/list.json?cursor=-1&screen_name=sitestreams&skip_status=true&include_user_entities=false but i am getting the response as {"errors":[{"message":"Bad Authentication data","code":215}]} – Krish Allamraju Dec 28 '12 at 11:08
  • Is this your issue? http://stackoverflow.com/questions/12684765/twitter-api-returns-error-215-bad-authentication-data – Peter Pajchl Dec 28 '12 at 13:07
  • Yes Exactly.. that is the issue.. i will follow the suggestions given by them, i will tell u wt the result, thanks for the support – Krish Allamraju Dec 28 '12 at 13:33