YouTube Live Stream API userRequestsExceedRateLimit - youtube-data-api

We used Live stream API to create live broadcast events, but it hit userRequestsExceedRateLimit when create live broadcast (POST /liveBroadcasts/insert). And Docs didn't specify any exactly rate limit number. Can help us to find max rate limit ,5 requests/sec or 8 requests/sec?
Here is error message (request rate 10/sec)
{
code:403,
errors:[{
domain:"youtube.liveBroadcast",
reason:"userRequestsExceedRateLimit",
message:"User requests exceed the rate limit."
}]
}

The official docs on rateLimitExceeded say:
The request was sent too quickly after the previous request. This error occurs when API requests to retrieve messages are being sent more frequently than YouTube's refresh rates, which unnecessarily wastes bandwidth and quota.
Every request to the YouTube API has a cost and rate limit, all of which add towards your quota. You can use a tool such as the YouTube Bulk Reports API to track your requests to see which ones in particular are causing you to go over your quota. All Live Streaming API calls (write operations) cost about 50 units. You can check the quota available to your application in the Developers Console.
In the Developers Console under YouTube Data API v3, make sure your "Per-user limit" under "Quotas" is set to the maximum value of 3,000 requests/second/user. If you're going over that, you will need to contact Google to increase your quota.

Related

How to Resolve a 403 error: User rate limit exceeded in Google Drive API?

I am getting
"code": 403,
"message": "User Rate Limit Exceeded"
while using Google Drive API in my web app
Although the quota is 10,000 requests per 100 seconds and my average is less than 2:
How can I resolve this error? How to implement exponential backoff as the documents say?
There are sevrail types of quotas with Google apis.
Project based quotas which effect your project itself. These quotas can be extended. If for example you your project can make 10000 requests pre 100 seconds. you could request that this be extended.
Then there is the user based quotas. these quotas limit how much each user can send.
User Rate Limit Exceeded
Means that you are hitting a user rate quota. User rate quotas are flood protection they ensure that a single user of your application can not make to many requests at once.
These quotas can not be extended.
if you are getting a user rate limiting quota then you need to slow down your application and implement exponential backoff.
How you implement exponential backoff is up to you and the language you are using but it basically involves just retrying the same request again only adding wait times each time it fails
the graph
the graph in the google cloud console is an guestimate and it is not by any means accurate. If you are getting the error message you should go by that and not by what the graph says.
After hours of searching and thinking, I found out that,
'User Rate Limit Exceeded' has a spam protection which allow max 10 requests per second.
Thus I found out a lazy trick to do so by delaying the calls using:
usleep(rand(1000000,2000000);
It simply delays the call by a random duration between 1 and two seconds.

YouTube API Quotas, please explain. Quota exceeded. How to solve?

Can someone please explain me in simple language how these quotas work?
I know where is a similar question, but I want an explanation related to the screenshot below.
First, I opened the quotas page in Google Dev Console for YouTube API.
But I don't understand what these lines are and how they work, why there are several lines?
For example, I was trying to make a simple request like this
https://www.googleapis.com/youtube/v3/search?part=snippet&q=welcome&type=playlist&key=[MY_API-KEY]
Which returns me a json response:
{
"error": {
"code": 403,
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
"errors": [
{
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
"domain": "youtube.quota",
"reason": "quotaExceeded"
}
]
}
}
So, I assume it gives me an error because somewhere there is a quota = zero, because I only tried to make this request once.
What should I do to get rid of this error and be able to use the API?
Thank you.
project based quotas
The YouTube data api is a cost based quota as opposed to a request based quota.
With request based quotas you are given a quota of say 10000 requests that you can make, each request you make removes one from your quota.
The YouTube data api is a cost based quota. This means you are given a quota of say 10000 points which you can spend on requests. Each requests has a different cost.
uploading videos costs around 1600 points against your request so you can upload a limited number of videos yet list only costs 50 so you could do more lists then uploads before running out of quota.
I recommend having a look at the quota calculator which will help you understand the cost of each request against your quota allotment.
This video may also help you understand cost based quotas YouTube API and cost based quota demystified
As far as the error you are getting from the following request
https://www.googleapis.com/youtube/v3/search
As search.list method costs 100 quota points each time you request it, this and the error message would suggest that you have exceeded your quota. You need to either apply for an extension or make fewer reqeusts.
How to check your current quota allotment:
Go to https://console.cloud.google.com/ -> library -> search for youtube data api -> quota
user based quotas.
Besides that there are also user based quotas which are the number of requests a user can make per second these are flood protection quotas.

GetStream update limit in free plan

Which are the limitations of free plan in getstream?
I have 8 members and 5 administrators following each others feed and I always get an email from GetStream alerting the rate limit when I make them follow.
Now I have an issue when updating activities. Perhaps I have reached my update limit, because sometimes when I try to create an activity, I get a ERROR TIMEDOUT.
We send out two rate limit messages: one for API calls, and one for feed updates. Our API call rate limit is about 2000 activities per minute, but feed updates are more like 50-100 per minute on the free plan. Setting up a follow relationship will trigger some feed updates as old activities get copied from other feeds to the new follower's feed.
When you do hit a rate limit, we don't stop your incoming traffic, but we de-prioritize slightly it so it takes a little longer to catch up. Our API v2 coming out soon will report rate limit information in API calls so you'll have more visibility into how close you are to hitting those limits before getting emails.
Regarding timeouts, which region is your app in (us-east, us-west, eu-central) and where are you located related to that area? We're going to be rolling out multi-region support later this year to minimize latencies there as well.

Understanding Quotas for Google API

I'm currently integrate Google+ API to my service.
I'd like to know what's the limitation for this kind of api:
https://www.googleapis.com/plus/v1/people/{user_id}/activities/public
in google develop console, I found this:
Quota summary
Free quota 10,000 requests/day
Remaining 9,998 requests/day
99.98% of total
Per-user limit
5 requests/second/user
I think there will be two kind of limitation:
Application level
For example, how many requests can an app send per day(sum of the number for all users), and what's the max qps?
User level
For example, how many requests can an app send per day for a special user, and what's the max qps?
But I can't find the exactly info, does anyone know?
Can't say particularly about this API, but when I used Google Places api the quota was linked with IP address.So if it expired, we need to use different IP for hit.No user / application quota.
you already have those answers in your question:
10,000 requests per day in total, using that developer console key, thus your total "app" calls.
per user there is no limit, there is a rate quota. a single user could at most make 5*(seconds in a day) requests per day.
in this specific api case this is much bigger than 10,000 thus that rate quota is not that useful (except it prevents users from quickly depeting the 10,000 daily quota).
you can edit that rate quota so its lower or higher, and is used so a single user cant consume all the app quota (maliciously or otherwise)

Does Apiary.io throttle responses?

I have an angularjs app that calls a RESTful service at apiary.io
Does apiary.io throttle responses and delay responses after a certain number have been received?
If so what are the parameters?
Currently, Apiary limits you for 120 reqs/minute/IP.
There are no artificial delays, but occasionally someones floods Apiary with production traffic and even when ratelimiting is fairly efficient, it may temporarily degrade service for other users.
You can (and should) check X-Apiary-RateLimit-Limit and X-Apiary-RateLimit-Remaining header. Once you'll hit the limit, Apiary will sent Retry-After header you should obey.
From their docs:
API Call Limit
API calls are subject to the default limit of 15 requests per second and exceeding this limit will result in all endpoints returning an HTTP status code of 429. Limits are per API key. If the limit is exceeding then the API Key will be blocked for the remainder of the sample period. If an API key continually hits the call limit we reserve the right to permanently block the key and to charge a fee to unblock the key.
To determine the API call amount we monitor the traffic over a sample period. If the traffic results in a particular API key reaching 80% of the limit (i.e., 12 if the limit is 15) over the sample period then the responses will start to contain a throttle node which contains useful information on how close you are to reaching the call limit.

Resources