I am interested in to get the number of followers of a user using the twitter API in my Android application.
I am reading with great interest the official twitter API documentation, however there is something that is not clear to me.
As I have understood, if I am only interested in the number of followers, just the number, I must use GET users/show in the API.
This call to the server has a rate of 900 profile/15 minutes.
However, I read that this limitation is for each user TOKEN I have.
My question is:
If my application is installed on, for example, 1,000 mobiles, my app will be able to make only 900 queries to the server for 15 minutes from the 1,000 mobiles? or each mobile, which each has a different user, will be able to make 900 queries for 15 minutes.
2
Answers
Here in Twitter API v2 rate limits section: User lookup has limit
300 per app
and900 per user
. These requests are forper 15-minute window
as stated in that section too. You mean 1,000 mobiles which I understand as 1,000 Twitter users logged into your application via Twitter login, if not change 900 with 300 for rest. However there is a note when you scroll down within a twitter blue box which has ‘Please note’ title. These note saysUsers' rate limits are shared across all Apps that they have authorized.
Besides at the very beginning it says:
The maximum number of requests that are allowed is based on a time interval, some specified period or window of time. The most common request limit interval is fifteen minutes. If an endpoint has a rate limit of 900 requests/15-minutes, then up to 900 requests over any 15-minute interval is allowed.
To sum up you can use at most 900 requests per 15-minute. It will depend on user’s activity with other Twitter Apps.
I suggest you to check parts at that page called HTTP headers and response codes, Recovering from a rate limit, and Tips to avoid being rate limited.
First,
/1.1/users/show
has been replaced with/2/users
, so use the latter going forward. If the 300-bearer/900-user-contexts rate limits are too cumbersome, there are three possibilities:User
v2 endpoint which has a suitably high rate limit and exposes theexpansions
parameter, which can be used to return in the response these data you are looking for,The API documentation for v2 is quite helpful for understanding how the
expansions
parameter works, but as a gross summary, it allows requests for, e.g., aTweet
object to contain additional properties of, e.g., the correspondingUser
, such as follower count.