I want to user Search API for twitter using 1.1 version.
There is a limit for 450 request per applications.
But I have a doubt in this rate limiting. I thought that it means we can make 450 request in every 15 mins of request window.
But I read(but i am not sure about what exactly i read) something like by default it returns 15 status based on search query. But if you query more status in single request it's considered based on the number of statuses.
Do they have a rate limit only for every 15 mins or they have rate limit for a day too?
So I couldn't understand how it exactly works ? Can any one help me with this?
Rate limits are segmented by the type of authentication, user or app. User authentication is any OAuth process that is based on the user. Application-only authentication is for your application credentials and not based on user. In the case of Search, you have a 15 minute window of 180 for user and 450 for app. For a higher rate limit (in the case of search) use application-only authentication. This will give you:
24 hours x 4 15-minute increments x 450 requests per 15-minute increments == 43200 requests per day
You just have to control your app so that it doesn't exceed 450 requests in a 15 minute interval.
Here's Twitter's docs on rate limiting:
https://developer.twitter.com/en/docs/basics/rate-limiting
You can also use the X-Rate-Limit-Limit/Remaining/Reset HTTP headers and the rate-limiting endpoint to keep track of where you're at and what's available:
https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status
Related
I have been using youtube data api v3 for 3 years. we aware of fact that youtube gives us provision to crawl data using client id, client secret and one security key as authenticated user.
Once in month i get exhausted with token usages but on next day it get reset at 12.30pm IST. but now I am seeing usages haven't been reset for 2 days. i checked on dashboard in quota section where i found
Query per min per user 180 000
Query per 100 min per user 300 000
Query per day 0 (Unable to reset manually.)
How to get that resolved? i found only support system for this is stackoverflow.
FYI : i do regenerate security and tried accessing but i can not.
To request tweets from the Standard search API with a specific hashtag, I've done
twurl "/1.1/search/tweets.json?q=#jesus"
Tht worked fine. Now wanting to use the Premium search APIs to count the tweets from the past 30 days with the hashtag jesus.
In it, there's a Counts endpoint, /search/:label/counts.
For the tweets from the past 30 days, that's the endpoint pattern, /search/30day/:label/counts.json.
I've created a Search Tweets: 30-Days Sandbox with name stackoverflow (that is the label).
Then, when running the following
twurl "/1.1/tweets/search/30day/stackoverflow/counts.json?query=#jesus"
I get
{"error":{"message":"Unauthorized: Stream is not enabled for count
requests","sent":"2020-02-26T13:26:57+00:00","transactionId":"00f67ea10058270b"}}
From this, decided to go to the app keys and tokens and regenerated both Consumer API keys and Access token & access token secret.
After
twurl authorize --consumer-key ************** --consumer-secret *****************
and using the PIN code I get
Authorization successful
If I do again
twurl "/1.1/tweets/search/30day/stackoverflow/counts.json?query=#jesus"
Then get
{"error":{"message":"Invalid or expired token.","sent":"2020-02-26T13:39:44+00:00","transactionId":"00dea42000a8a098"}}
Regenerated again both Consumer API keys and Access token & access token secret but still no success.
How can I do it then?
Counts is only available to paid premium accounts, and one needs to pay for premium access.
Use this link to Apply for access.
Account linking problem for only some of our users, most users link account normally. For users linking account failed, they just see the login page refreshed to empty account name and password.
From our server log, we found for users that fail to link, the user accesses our server successfully and got OAUTH code, but after about 15 seconds, google server accessed our server to exchange the code for a token. However, the code has expired by this time.
For successfully linked users, the time between issuing the code and exchanging it for a token is about 2 seconds.
Does anybody know how to resolve the problem? Thanks.
It sounds like the expiration time for the authorization code has been set to about 10-15 seconds. While the auth code should have a short lifetime, 10 seconds is way too short. The recommended lifetime should be no more than 10 minutes, not 10 seconds.
Consider that this code needs to be sent back from your server to the user, from the user to Google, and then from Google to your server. On some networks, each step might take more than a couple of seconds, particularly since it must be done over HTTPS this adds both network and processing overhead. Each step adds just a few fractions of a second - but they can add up on some devices!
There could also be a slight clock skew between the issuing server and the processing server - likely not much, but when you have a lifetime of a just a few seconds, even a 1 second skew could be too much. If the two are very out of skew, then this could be the cause of your problem as well. Make sure the clocks on your servers are at least reasonably in sync.
The best solution would be to increase this timeout on your server when you generate or accept the code. You may have thought you were specifying 10 minutes for a configuration field that actually accepts seconds.
I am testing an idea before turning it into code, and I want to retrieve Twitter DMs for a user. I am using the Twitter Console to test everything out.
According to the docs for both direct_messages and direct_messages/sent (emphasis mine);
Returns the 20 most recent direct messages sent by the authenticating user. Includes detailed information about the sender and recipient user. You can request up to 200 direct messages per call, up to a maximum of 800 outgoing DMs.
I want to grab that maximum 800, I have tried two types of call for this — What am I doing wrong or is there a mistake in the API docs?;
Using Pages
Using count and pages I figured I would be able to page through to page 4 with a count of 200 (making the 800).
https://api.twitter.com/1.1/direct_messages.json?count=200&page=1 works and returns 200 results
https://api.twitter.com/1.1/direct_messages.json?count=200&page=2 works but returns 0 results
The same happens when using direct_messages/sent.json
Using max_id
When calling https://api.twitter.com/1.1/direct_messages.json?count=200 I noted that the returned DMs are ordered by the newest first. So I grabbed the ID of the earliest DM of the 200 and fed that into max_id, assuming then this would give me the next 200 that were earlier than this.
https://api.twitter.com/1.1/direct_messages.json?count=200&max_id=482007447041609700 works but returns 0 results
Notes
I have more than 200 DMs in my account.
You have to authenticate with oAuth in the Twitter console to test out these URLs
I found a thread on the Twitter Dev forums of others experiencing this
I'm working with the twitter API 1.1 but I found this strange behavior:
The remaining value of the rate limit after a call to users/lookup is not decremented. If I use this call, when I check the rate limit status I don't see any changes:
https://api.twitter.com/1.1/users/lookup.json?screen_name=twitterapi,twitter
and I can't understand why the rate limit for the function users/show works only using the parameter user_id and not using screen_name (why the API developers have imposed this constraint?)
To check the rate limit I use the call:
https://api.twitter.com/1.1/application/rate_limit_status.json?resources=users