Twitter API call limit - per token or per IP? - api

I am developing a feature that display the recent 5 tweets for a particular tweeter user. I am using the application-only authentication and get the bearer token to query the tweeter API.
I saw there is a limit on the numbers of request to Twitter API in every 15 mins.
https://dev.twitter.com/rest/public/rate-limits
user auth app auth
GET statuses/user_timeline statuses 180 300
My question is the limit is per bearer token or per IP?
For example, If
User A and user B are using the same token, query the same user's timeline(Eg, Yahoo), would the limit will be 300/2 for each user in every 15 mins?
User A and user B are using the same token, query the different user's timeline(Eg, One for Google, One for Yahoo), would the limit will be 300/2 for each user in every 15 mins?

Yes, it will be divided by 2. It is recommended to use User authentication to user credentials for such case.
The rate limits are on the endpoint. So if you do 5 requests that start with statuses/user_timeline statuses only 295 request will remain.
I am not sure if you know c# but you can check this quite easily with the Twitter library Tweetinvi as followed:
var remainingBefore = RateLimit.GetCurrentCredentialsRateLimits().StatusesUserTimelineLimit.Remaining;
var tweets = Timeline.GetUserTimeline(userId);
var remainingAfter = RateLimit.GetCurrentCredentialsRateLimits().StatusesUserTimelineLimit.Remaining;

Related

eBay API token detect if a user has already reauthorized, any way to decode the eBay token?

I have a web application that will authorize a user with eBay so that I can post items for them. But I want to cap the limit at 50 per account and eBay account. I can easily track how many item posts they performed in my application. But what prevents the user from opening another account with my application and re-authorize with the same eBay account.
So I tried it with my application and my eBay account and looking at the tokens from account1 and account 2 there's literally 5 characters difference at the beginning of the token String (around character 15). Rest of the token is the same.
Is there a way to tell from the token if it's the same account?
Ok to handle this you would need to get the eBay User and compare to see if they have already registered. Using the user authorized token make a call to get the user details via:
ApiContext.getApiCredential().seteBayToken(FetchTokenCall.fetchToken());
GetUserCall gu = new GetUserCall(ApiContext);
UserType user = gu.getUser();
Now compare and save relevant data.

get all of the user media with Instagram API return empty parameter

I'm in a problem with Instagram API and min_id and max_id parameters.
My authenticated user have over 100 medias but when I try to get another part of the user medias over his first 20 medias it get empty data JSON parameter.
for example, my first media id is 1173958321567246146_177152120 and the last one is 1070424319045215888_177152120 but when I try to send the request with this URI I get an empty array:
https://api.instagram.com/v1/users/177152120/media/recent/?max_id=1070424319045215888_177152120&access_token={MY_ACCESS_TOKEN}
I think you are in sandbox mode? sandbox mode is limited to last 20 media items in API response.
Here is more details about sandbox mode: https://www.instagram.com/developer/sandbox/
To help you develop and test your app, the users and media available
in Sandbox mode are real Instagram data (i.e. what is normally visible
in the Instagram app), but with the following conditions:
Apps in sandbox are restricted to 10 users
Data is restricted to the 10 users and the 20 most recent media from each of those users
Reduced API rate limits

Increase the limit of 20 instagram api request

I have a php script to follow the followers of famous person, this script uses instagram api to do this.
When the script runs, it follows few persons of the overall list of users. How can I increase the "20" limit of this request ?
Any idea ?
Instagram just changed their limits, I have a website: http://instapromobiz.com that can follow/unfollow 60 users an hour.
You must first disable implicit (client side) authentication and then enforce signed headers in your client manager. Then when making a request sign your headers. See here:
http://instagram.com/developer/restrict-api-requests/

Are eBay user tokens permanent (Fetch user token API)?

According to the eBay docs: "With one-time setup complete, your application can respond to prospective users and get tokens for them." However, the article also mentions that the tokens expire after 48 hours. Does this mean that my users will have to re-login every 48 hours through my website to renew the token? If so, how is this a one-time setup?
Update 1: According to this article, tokens expire after 18 months.
Tokens expire after 18 months. The call returns a HardExpirationWarning element 7 days before the token expires, at which point the user has to go through the consent process again. The token is associated with the session ID for 48 hours, before which the developer has to fetch the user's token and save it for future API calls.

Instagram api limit in large, public app

We've a large open system which offers the possibility to host a large number of apps. Every app has roughly 100 to 500 active users. The backend has the option to add a photo album page and I'd like to add Instagram as a feature. The app admin only has to add the username of his/her instagram account to make the connection. But with this number of apps and end users we reach the api limit with our developer account rather quickly. Is there some sort of workaround for this?
From my understanding the API limit is 5000 requests per hour per access_token or client_id. Since every user on your system should have their own access_token, and as long as the requests from your application uses each individual access token, you should be fine since that limit is going to be a per user limit.
Refer to Instagram End Point > Limits
You are limited to 5000 requests per hour per access_token or client_id overall.
Practically, this means you should (when possible) authenticate users so that
limits are well outside the reach of a given user.