Get Google Apps user's used quota - reporting

I've been trying to obtain a Google Apps user's used quota and I find that it is possible with Admin SDK Reports API. However, it seems that it can only give you information from two days ago and before. This is the error I obtain:
Reason: "invalid"
Code: "400"
Message: "Data for dates later than 2014-06-04 is not yet available. Please check back later"
Domain: "global"
Is there any way to obtain this information in real time, or at least from the same day of the request?
Thanks in advance.

Quota is available via both the Drive api about.get() API call:
https://developers.google.com/drive/v2/reference/about/get
As well as via standard IMAP QUOTA command.

Related

googleapi: Error 500: Internal error encountered., backendError when calling Admin SDK

This is strange we have started receiving too many per day (nearly 300-500 times)
googleapi: Error 500: Internal error encountered., backendError
while calling Admin SDK Directory API. https://developers.google.com/admin-sdk/directory
Google chat support for API is removed and Facing issue with how to address the problem. Our rate limit and query calls are way in the limits. We query Admin SDK as a cronjob schedule.
Is there a way we can debug 500 errors for AdminSDK
Is there any information regarding which deployment Region of Google is more capable to handle load?
No error on console
Logs error
Contact Workspace Support or File a Bug
As DalmTo pointed out, 500 errors are usually out of your control. Especially in this case since you are calling Google's servers.
The best option to debug these errors is probably contacting support directly. You can find the corresponding contact information for your Workspace account ⁠on this page.
https://support.google.com/a/answer/1047213?hl=en
If you are able to regularly reproduce this and you think its a bug, fill out the template here:
https://issuetracker.google.com/issues/new?component=191635&template=824102
Ensure to include your code, complete reproduction steps, some evidence/statistics of the failures, and any other information you can give.
This usually happens when the Google Cloud Platform service account used for authentication was created after the in-app products.
To solve this, make a trivial edit to your in-app products in the Google Play Console. For example, add a temporary tag. Then try again to make the request and it should succeed.
By the way, the same is true for the purchases.voidedpurchases which reports an "insufficient permissions" error.

Google Calendar Limit Problem Even Billing was Registered

I already use Google Calendar API for some months with no problem, but in 28th of August I get an error. The error message is "403 Calendar usage limits exceeded".
Accordingly to Google API Console I didn't reach daily quota limit (I use Service Account).
I was tried to read the official documentation, but everything is okay by my usage.
Here I attach some information from my dashboard.
How can I solve this problem?
Thanks in advance.

My Google API keeps returning a limit reached error, when I am sure I am under the limit

I am currently building a NodeJS backend app that is querying the Google Calendar API. I have setup a new project on Google Cloud API platform and have generated all the required credentials. As stated by the google calendar API page, the allowed queries per day is 1,000,000. Since I am only querying for testing purposes at the moment, I am sure that I haven't even hit a 100. Yet whenever I try to query the API it returns the error:
"The API returned an error: Error: Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
Also I have noticed that the dev console has generated a API key for me. Where am I supposed to put that?
My initial thinking is that Google API requires me to perform an additional signup using some CLI tools or something along those lines to signup. If not, where am I supposed to sign up?
Thanks in advance.
Note: I already have all the information from the cloud platform such as client_id, client_secret, project_id.
In "Error: Daily Limit for Unauthenticated Use Exceeded", they key word is Unauthenticated. Your request to the Calendar API is missing an OAuth Access Token. You will need to research Google OAuth.
This question has been answered many times. Please learn how to search SO for similar questions whenever you post a new question. https://stackoverflow.com/search?q=google+oauth+%22daily+limit+for+unauthenticated%22
To anyone who comes across this post in the future. I fixed the issue by using the project generated by Google Calendar API site (https://developers.google.com/calendar/quickstart/nodejs) by clicked the big blue "Enable the google calendar api" and then changing the name of the quickstart project that was generated. I don't know why it works now but it does and it's been working quite stably so far. Lets see how to goes.

can't change user-limit on calendar api via google developer console

I had some issues in the production environment with error "403: User Rate Limit Exceeded" when using the google calendar api. The error description page suggested to change the user limit in the developer console.
Logging into the developer console i did see a user limit of '5 requests/second/user' as seen in
After clicking on the pencil, i saw
Because i was unable to put in any number, i ended up deleting the content of the box and saving it. After that the api was unavailable due to 'not enabled'.
To try and restore the previous state of the api, i disabled it in the developer console and re-enabled it. This does not have the indended behaviour:
So now i'm stuck with an api with no global quota and a zero user limit, which can not be changed (no pencil to be seen anywhere).
I need to get this service restored asap.
Note: this behaviour is reproduceable on any new project by adding the google calendar api and following my steps.
I filed a quota increase request with explanation in the comment to google.
They responded today:
Hello xxxxx,
Thanks for reporting the configuration error you're seeing for your app (Project ID xxxxx) when setting your "per-user" limit to 0.
I've increased your "per-user" limit back to 5, you should see this amount in your console now.
Apologies for any inconvenience you may have experienced.
Regards,
Frank
Developer Platform
In the developer console i can see the quotas and the limit of 5 requests/sec/user. The service is also back up.
Thanks Frank from the Google Developer Platform.

Google directory api always returns 403

I am trying to use the Admin SDK Directory api to look up user profiles. I am able to do this successfully all day (with in quota) with 99% of the time. Though there are certain times where it just fails no matter what.
Yes I have set the service account user, I have the proper scopes, I have admin api turned on.
It even fails in the google api explorer. See screen shots
The call:
https://www.dropbox.com/s/9v9m6s5zf76oix7/call.png?dl=0
The response:
https://www.dropbox.com/s/te6k3x5xjkr467j/response.png?dl=0
Sorry for the links, images keep showing as broken
After contacting google they supplied an answer. There is a setting for the contacts app that enables and disables this.
Admin console >> Google Apps >> Settings for Contacts >> Advanced settings
Contact sharing: Enable contact sharing
Make sure that is enabled and it works.
Here is a screen shot: https://www.dropbox.com/s/8jmzz7zw0xq4ux4/answer.png?dl=0
Honestly, it just seems like some sort of transient error on the Google side. Being that it's working ~99% of the time for you, means you're not doing anything wrong. I would consider this more true b/c you're also using a Google Tool rather than your own so you know it's not the code. When it's failing for you, does it also then fail with the API explorer? What about with the OAuth Playground?
If this is reproducible consistently (same times, after X amount of requests, etc.), it would be worth reporting the the Google for Work Support team (assuming you have the ability to contact support) as it sounds like a bug and they would be able to help with break/fix for API issues.

Resources