http://stackoverflow.com/questions/5565811/url-to-get-my-twitter-followers-says-requires-authentication-even-though-i-am

I want to get the user_id fields of my Twitter followers.

Seems like this API method is what I am looking for:

http://api.twitter.com/1/statuses/followers/NicolasRaoul.xml

Unfortunately it returns an XML file that says This method requires authentication.
Even though this method is documented as Requires Authentication: False
Furthermore, I am logged into Twitter as NicolasRaoul (typing URL in the same browser).
What am I doing wrong?

link|improve this question

feedback

The Twitter screen name NicolasRaoul does not exist as of this writing, so that could be part of your problem.

When I clicked the link you provided, I received the same error message you did, however shortly thereafter, I tried again and received what I expected to receive:

<?xml version="1.0" encoding="UTF-8" ?> 
<hash>
    <request>/1/statuses/followers/NicolasRaoul.xml</request> 
    <error>Not found</error> 
</hash>

I don't know why I initially received the request to authenticate; I should have received a 404. For what it's worth I can say, after all my years of working with the Twitter API, that Twitter can be pretty flaky every once in awhile, so let's just hope your error was due to Twitter having a bad day.

Since NicolasRaoul doesn't exist, I'll use Nicolas_Raoul (hopefully you) for the following examples.

For your use case, I would suggest utilizing http://api.twitter.com/1/followers/ids/Nicolas_Raoul.xml to get up to 5,000 follower user IDs. If you have more than 5,000 followers, you'll need to make use of thecursor parameter. Documentation is here.

Alternatively, you could use http://api.twitter.com/1/statuses/followers/Nicolas_Raoul.xml to get the full user objects of 100 of your followers returned in the order that they followed you. If you have more than 100 followers, you'll need to again use the cursor parameter. Documentation is here.

Note that for all Twitter API calls, I recommend using JSON since it is a much more lightweight document format than XML. You will typically transfer only about 1/3 to 1/2 as much data over the wire, and I find that (in my experience) Twitter times-out less often when serving JSON.

 
Posted by chacolina