Google analytics API with a service account wrongfully Quota Error - google-api

tl;dr: I'm getting Quota Error: You have exceeded the maximum number of writes/day for this project even tho I have 50k queries / day as the quota limit.
I have a project on google cloud consle with GA API enabled:
Oddly enough, in the GA Quotas view I see two anonymous Query sections, both with 50k queries / day: (deleted the graphs to capture both quotas on same screen)
A side question here, why do I have two Query sections? what does each mean?
I have a service account with access to this project:
with a generated JSON key:
and I'm using that service account to make API requests:
const path = require('path')
const { google } = require('googleapis')
module.exports = createApiInstance
const keyFilePath = path.resolve(__dirname, '../../credentials.json')
const auth = new google.auth.GoogleAuth({
keyFile: keyFilePath,
scopes: ['https://www.googleapis.com/auth/analytics.edit'],
})
auth.getClient().then(client => {
client.request(params)
})
I can get away with just a few requests in a day before I run into the quota limit error.
One weird thing is that even tho I just made some requests a few minutes ago, the service account's logs come up empty:
Which would be tempting to say the service account isn't being used, but, if that was the case how would I be able to get away with the few requests that do actually pass?
I'm not using any Auth'ing other than the service account generated credentials file 🤷‍♀️
As an aside, we are using the same service account with the same credentials file on another project for a different google API, and it works as expected.
any ideas what's going on here?

First off do not go by what you are seeing in the google developer console.
The report does not display write requests only total requests.
Default write request quota is 50 not 50000
that is not Realtime report
its a estimate it is not 100% correct
not all apis write to the service account logs.
this is a project based quota so if you have any other methods writing then they are in the same total.
If the error message says you are going over the limit you are going over the limit. Just apply for an extension. This is one of the easer apis to get an extension on.
Limits and Quotas on API Requests
You have to go over to https://console.cloud.google.com/ to see what your writes per day are

Related

Google Places autocomplete API limit

We are trying to use the Google's autocomplete API. ITs is already linked to Facebook payment account. but when we try to hit the API, it failed after 750 requests.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Kids%20jp%20nagar&key=APIKEY&fields=address_component,formatted_address
{"error_message": "You have exceeded your daily request quota for this API. If you did not set a custom daily request quota, verify your project has an active billing account:
http://g.co/dev/maps-no-account",
"predictions": [],
"status": "OVER_QUERY_LIMIT"
}
When we checked the limit it showed that maximum we can set it to only 750/per day in I AM section.
But in API's usage section it shows that API usage is Pay as you go. Is there any method to use more number of APIs in single day. We need to automate and cleanup the customer address database.

YouTube Data API daily quota reduced to 0

For some reason, I started getting 403 errors on my app(in development), the errors message was
Access Not Configured. YouTube Data API has not been used in project XXXXXXXX....
This is weird because I was using the API for the last month or so with the same project, and didn't do any changes.
After looking in the project settings I noticed that the daily quota was reduced to 0.
The only thing concerning the API that I did was to request a quota increase in order to keep developing(The default quota stalled the dev on the search functionality of my app), but I didn't get any answer concerning that request other than asking for info, no warnings, or anything really.
I'm pretty sure that my app complies with the Terms of service, so I don't think that is the reason.
Any help would be appreciated. Thanks!
I would check your email it sounds like your project was disabled. Have you been though the verification process?
YouTube reserves the right to disable or curtail your access to, or use of, specific YouTube API Services if your API Project has been inactive for 90 consecutive days. For example, YouTube could revoke your API Credentials, or reduce (or eliminate) your API Project's quotas for specific YouTube API Services. If your API Client's quota is reduced or eliminated, you may reapply for quota or a quota extension, and YouTube will review that application based on YouTube’s determination of your expected use of the YouTube API Services.
I would check your email. I have several emails about projects i no longer use which have had the quota reduced to 0 over the last few weeks.
How to reset
No matter what the clients you have now are not going to work you need to reset the project.
Delete all client ids you have now.
deactivate then reactivate all APIs you need
Create new client ids keys
If you're trying to use an old project, then it's not gonna work. You'll have to create a new project.
Create a new project.
Enable Youtube API for it. (Your quota will be reset to 10,000/day)
Get new API key for it.
Use the new credentials.

How can I read current Google Analytics API limits or used quota

We have a widget which filters analytics referrer spam in Google Analytics by adding 30+ filters to each property-view.
Google Analytics API has a limit of 500 write operation per day, which sucks, because our widget is used a lot and we need around 35 writes per property-view.
I'm looking for a way to read the current API limit so I can notify users when the limit is reached, because right now I'm showing a message when I get an error message from Google - after the request. Which is annoying.
Google Dev. Console contains the usage per API call and what would be enough for me to know when we reached the limit.
My question: Is there an API which can read out this data for the past 24 hours?

Youtube API v3 - Can I get 50M quota per user if using Access Token(Oauth2)?

Can I get 50M quota per user if using Access Token(Oauth2) with Youtube Api v3?
Or will it be bound to my Project ApiKey, and therefore I will only get a quota of total 50,000,000 for my application ?
thx! :)
Quota usage for the YouTube API is project based not user account based.
So if I authenticate your application / project and make 10,000,000 requests, then you authenticate application and make 40,000,000 you will have blown the quota out.
There is one quota that is user based Per-user limit 3,000 requests/second/user but this can be gotten around by sending a random quotaUser with all of your request. This tells the API that each request comes from a different user, but I didn't tell you about this.

Get Google Calendar API Limit

Is there any way to get the requests quota of Google Calendar API by calling some API method in code?
I know that I can see the total and remaining requests count on the project dashboard. But, I want to fetch it in my application and display it to admin user on a web page for convenience so that he doesn't need to sign in to Google to view the quota.
Thanks
No there is no way to see how much of the Quota you have used on any of the Google APIs. I normally keep a running count of requests for display to the user. But there is no way to check what the over all quota usage is for the application.
I have done send feed back from the Developer console several times asking them to add an API. There are cloud monitoring APIs but nothing for monitoring quota usage.

Resources