Search code examples
twitter

How to get a count of followers from Twitter API and trendline


I am in the process of writing some reports for the number of followers over time for Twitter, however after substantial searches and trial and error, I have not being able to get the number of followers over time - particularly past number of followers.

I know there is an API to get the individual userIds for the followers, but thats an overkill for what I need and I would have to call it everyday. Ideally it would be great if I can pass a date and it could return the number of followers.

Does anyone have any experience with this and what the API might be!

Thanks


Solution

  • While there is no direct API to get the trendline, getting the followers count is fairly easy, access via the URL:

    http://api.twitter.com/1/users/show.json?user_id=12345
    

    The documentation has it all @ https://dev.twitter.com/docs/api/1/get/users/show

    To get the trendline, seems like I will need to query it on a daily basis!

    Updated to Twitter API v1.1

    https://api.twitter.com/1.1/users/show.json?user_id=12345
    

    Documentation at https://dev.twitter.com/docs/api/1.1/get/users/show

    Updated 31-May-2018

    The new API end point is at

    https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show