I’d like to ask a few questions regarding the REST API v1.1, so that I can use it in the best way possible.
Is it possible to open a connection to the streaming API, and while that connection is open, also use the REST API? If this is allowed, are the rate limits the ones described here: https://dev.twitter.com/docs/rate-limiting/1.1/limits ?
Is the 15-minute window a sliding one or does it refer to consecutive, non-overlapping slots? Let me explain the two cases. Let’s assume a 15 method call limit for in a 15’ window.
Case 1 [sliding window]: Within any 15 minute interval, no more than 15 method calls are allowed. If we submit 1 query during the 1st minute of the 15’ window, we are allowed 14 more queries within that window. However, the sliding window adds an additional constraint, that at the 16th minute (i.e., 1st minute after that interval ends), we can not perform 2 queries. because then there would be 16 queries in the interval [1’, 16’].
Case 2 [non-overlapping interval]: The 15’ window starts at time T, when the bearer token has been received (i.e., when the user authenticates). From that point on, we split the time in non-overlapping intervals, of 15’ each, and the 15 method calls count for each interval separately, independently of the rest. More generally, we are allowed 15 method calls in [T+i*15’, T+(i+1)*15’], etc., regardless of how the queries are distributed within such interval. In one interval the queries can be evenly distributed, whereas in the next one we can submit all of them at the start.
I guess the proper way to do it is the former, because the latter would cause ripples of queries, but it’s better to know which case you actually mean, because this affects the querying policy.
- From the table where the rate limits are described ( https://dev.twitter.com/docs/rate-limiting/1.1/limits ), there are some cases, where the limits are different for user and app-only authentication.
First off, I honestly have no clue how to “authenticate” as application-only (despite https://dev.twitter.com/docs/auth/application-only-auth ). Perhaps the library I’m using (twitter4j) does not support app-only authentication, but unless I provide all 4 (consumerKey, consumerSecret, accessToken, accessTokenSecret), I get an exception that I can not be authenticated. I’m probing my account which is not protected.
Having said that, my actual question is the following: Take the “GET search/tweets” method for instance, which has a limit of 180 calls / user, and a 450 / app. On the other hand, “GET lists/members” has 180/user while only 15 / app. Given that I (have to) authenticate myself using all 4 information, which limits apply? No one else is using the application that I have created. Could I safely assume the maximum of the two limits, i.e., 450 for the “search/tweets” and 180 for the “lists/members”?
As I’m the sole user of the application, and the rate limits are distinct for user and app, could I assume the additive value as the limit for each method (e.g., 450 + 180 for “search/tweets”) ? Knowing this information in advance can help optimize query-scheduling policies.
Sorry for the lengthy email, I really hope someone will take the time and reply. I’m trying to use the REST API as efficiently as possible, and don’t want to get my account blacklisted due to trial and error
Thank you very much in advance!
PS: If you have any pointers on how to authenticate as app-only with twitter4j, I’d really like to know. Thnx again!