Hi folks, this is Jeff Posnick from the YouTube developer
relations team.
And I'm coming at you with another episode
of YouTube Developers Live.
We're going to continue our series of shows focusing
on the ways developers can move from version 2 of our data API,
to the newer version 3.
And today's topic covers something
that's a little less technical, but certainly
important for developers to understand.
And that's how quota works in version 3 of the data API.
So anybody who's had a history using YouTube APIs
knows that understanding how quota works is quite important.
It is possible to run into quota issues.
If you're too aggressive with the types of API
calls that you're making.
And there are some changes in how
quotas are handled in version 3 that we're
going to cover shortly.
So the best overview of what's new with quota in version 3,
is that there's a lot more visibility
as to what's actually going on.
The quota in version 2 of the API
was a little bit more opaque.
We didn't have any exact numbers attached to operations.
We didn't tell you-- you've reached 50% of your quota usage
on this given day.
You just kept making calls until they stopped working.
And you got a quota error.
And best practice, at that point,
was to pause a little bit and then try to make calls again.
But in version 3, we have a lot more information
that we're sharing with developers.
And hopefully that can help you plan ahead.
And make sure that you're making intelligent choices about how
you're using the quota that you do have.
So, the first thing to keep in mind,
is that there is a global bucket of quota that
gets assigned to each developer registration in the API
console.
Everybody needs to register before they
can use version 3 of the API.
And everybody gets 50 million quota units.
If you played around with the data API
back when it first launched, you might
have seen a lower limit of 5 million quota units.
We bumped that up to 50 million quota units a little while ago.
And that is something we definitely
anticipate should be enough quota for the vast majority
of uses out there.
So the way those quota units work,
is that there's really a global pool.
And every time your application makes an API call,
some quota gets deducted from that pool.
If you get down to zero, then you
run out of quota for the day.
There is also some shorter term quota limits
that are in place to protect a rogue instance
of your application from going completely out of control
and draining all your quota.
And that's actually something that you
have a little more control of.
Setting what you want those per-IP or per user
limits to be.
So, let's take a deep dive into the tools
we have for understanding the quota usage.
And managing those quotas and per-IP limits.
And I'm gonna pull up a screen share right now.
And you can see what I have opened
here is this page, that we have a link
to from our documentation.
From developers.google.com/YouTube.
You'll find it in the left hand nav over here,
under data API version 3 tools and quota explorer.
And this gives you insight as to how many
quota units each of the different version 3 operations
consume.
And just a basic rule of thumb, operations
that are read only time especially searches
tend to take very few quota units.
And operations that involve some sort of writing, or uploading,
or deleting things tend to take more quota units.
So if I go over here.
And say, I'd like to do a search.
And the only thing that you can do with a search is a list.
And you're saying you want to get this snippet back.
That's going to end up costing you two quota units.
So you can do 25 million of those a day basically.
The reason that there is this column over here for parts,
is that we do charge a little bit more for additional parts
that you request.
This comes, not so much for searches,
but if you're doing a videos list, for instance.
And you say that you want to get back
both the snippet and the content details.
That bumps it up from three quota units
to five quota units.
And the idea being, we have to retrieve a little bit
more information on the back end.
So it's going to cost a little bit more
for you to make that call.
Still though, that particular operation
cost five quota units.
You can make 10 million of those per day from your application,
basically.
Let's try a couple of other things, like write operations.
If we're going to go over here and say,
we don't want to do a playlists, insert, and specify this.
You'll see that this is 53 quota units
for doing a playlist insert.
So a little bit of a higher cost.
Because this is a write operation application,
it can't do quite as many of them.
And again, still, we think the quota
that we give people by default is quite generous.
And, finally, the operation that ends up
taking the most quota currently in the API is a video upload.
And again, to specify this part over
here-- maybe we'll put in status or something
too-- that bumps it up to 1600-a-quota that that takes.
So that still lets you do quite a few uploads
from your application per day.
I think something around 30,000.
So that's not a small amount, by any means.
Even though this operation does cost more
from a raw quota cost perspective.
We still think it should be enough to get
you going for most of your uses.
And I wanted to jump, now, to some tools
that you could use to actually see
how much quota your application that is already
live out there is consuming.
And help you intelligently plan for what's going on.
And this is done via the Google Developers console.
So I'm over here.
And it's a sample application that I have--
accessviacloud.google.com/console.
And I've gone over here to the APIs section,
under APIs and auth.
And I've chosen the Data API v3.
And you'll see here, this actually gives you
quick access to the API Explorer,
that we've talked about before.
But, what I wanted to do from over here,
is click on the Reports button.
And this is going to take me, actually, to a different page.
Which is a little bit more of our older interface
for interacting with the API's console.
But this is the interface that shows you
how much quota your application's actually
consumed on a historical basis.
Actually, let me rephrase that-- it shows you
how many operations your application made.
So this is a raw number of API calls.
And, probably, it is a little small on the screen right here.
But you can see it's a nice little chart for data API
v3 usage.
So this doesn't directly map, in this chart,
to the actual quota consumed.
In order to do that, you kind of have to dig down a little bit.
And take a look at the methods that your application
has been calling.
And you see over here that there's
been 2.3 million search list operations.
Some playlist items list operations.
And so on and so forth.
And it gives you a good idea as to what you're actually
doing from your application.
If you have just written some simple script
and you've deployed it to your server,
and you're the only one running it,
this probably isn't as interesting
as if you've written an application
you've released on some app store.
And you really are interested in seeing how much usage it's
getting for all the different API methods from all the users
out there.
So, hopefully that's useful information for folks.
There's also just one extra tool that I'm not
going to go into too much detail about.
But it could be useful.
This is Quotas, from that same tab over here.
And if you go to the Set Per-User Limits,
you will see you'll have a chance
to change the quota that each individual user
of your application is granted.
And you'll see over here, for data API v3 for instance,
the default is two units per second per user.
So if you do have an application that's deployed widely,
and you are concerned that the default limit is not
large enough.
Or you want to tighten the default limit a bit.
You have the ability to adjust it over here.
And make sure that no single user of your application
can really deplete that global quota pool all the way down
to zero.
So hopefully this information was useful for folks
out there getting started.
With the v3 API, or whether you've already been using it
for a while, and just didn't know
you can check in on the quota.
And stay tuned for more videos in series.
And we hope it's helping folks make the move from v2 to v3.
This is Jeff Posnick from the developer relations team
and have a great everybody.