Service invoked too many times: translate. What is the quota? - google-apps-script

I am receiving this error message "Service invoked too many times: translate" in my google apps script. My script is running every 5 minutes. How could I find what is the quota ?
Is there a way to increase this limit ?
I have not had this problem in the last days. It just appeared today.
Many thanks!

Go to your Google Developers Console Dashboard. Select your project, then click on "APIs" in the left-hand menu. On that screen, click on the "Enabled APIs" tab.
If you don't have never used Google Developers Console, then step one would be to sign up. Then, create a new project, enable the Translate API, use the API keys provided during the setup in your project. Now you can track your usage.
However, I believe the Google Translate API is a Paid-for-only API. That could be your core problem?

Related

Google Apps Script : retrieving Working Location from calendar

a recent feature in Google Calendar allows users to select a working location (home, office, other) for every working day.
Do you know if there is a way to retrieve this info using Apps Script ?
Thanks
Mathieu
Answer:
This is currently not available to the API.
Reference:
Here is a list of all the settings available to the API: Settings.
You can notice that many settings from https://calendar.google.com/calendar/u/0/r/settings are not available, including Enable working location. Since this is a very recent feature, it's not strange that it hasn't yet been added to the API.
There is a Feature Request:
Another user suggested this feature to be implemented in the Calendar API. You can click on the star next to the issue number to give more priority to the request and to receive updates:
https://issuetracker.google.com/199918380

Get Google Drive video view count from Apps Script API?

I have a series of videos uploaded to a specific Google Drive folder, and I'd like to get the view count for each video/file. Literally as simple as "file_id" "10 views".
From extensive research, it seems this is quite simply impossible within Google Apps Script today? Per this old answer, both the Drive API and the Drive Activity API only report edit or comment activity, while view activity is ignored. The Reports API does support this, but only for users with Admin access in an Enterprise account (not for us plebes who just want to know view counts on our own files).
And per this Apps Script documentation, it seems that onOpen() triggers don't run for views (which blocks a "view_count + 1 on open of this specific file" sort of analytics).
Before I give up, I figured I'd run it past this brilliant community: am I missing anything? Is there some way to get view count on videos stored and accessed through Google Drive?
Answer:
You are correct in your findings that you can not get video view count information through the Drive API. You must use the Admin SDK to obtain this information.
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Google Drive component, with the Feature Request template.

Error GET Google Places API

Today, Google places API stopped working on my site. Yesterday, it was working just fine. When I call it, I get following error in developer's console:
GET https://maps.googleapis.com/maps/api/place/js/AutocompletionService.GetPredictions?1slux&4scs-CZ&9sgeocode&15e3&key=AIzaSyCe8-UQIQuXtaQ5xVOqtwnCtZOjDtXj4Co&callback=_xdc_._8rz5bv&token=109805 net::ERR_ABORTED
The problem isn't in Google maps API itself, because that works just fine (without the Places). If I take fresh code snipper from Google website, it is still not working, as you can see here. So the problem isn't in my code, but in the API itself. I checked my project on Google site and the API is enabled, so it should work. Maybe it's connected to my API key? I haven't tried creating a new one, I don't want to have too many of them.
SOLUTION: After approximately one hour (from posting this), it started working again. Apparently a problem on Google side. So if you have the same problem:
Go to your Google account and check in API manager if the Google Places API service is enabled.
If it is enabled, wait and be patient. Hopefully it will fix by itself.

cannot enable BigQuery for apps script project

Since yesterday I can no longer successfully enable the BigQuery API in my apps script projects. I have done this literally hundreds of times over the past months, so I am very familiar with the process. Since yesterday the enabling doesn't actually take effect anymore.
Steps to reproduce:
Create or locate a BigQuery project & dataset, find the project numeric ID.
In Google Drive create an apps script project
Paste the following function:
var projectNumber = '1111111111'; // Google cloud BigQuery project *number* not alphanumeric id
function bqtest() {
datasets = BigQuery.Datasets.list(projectNumber);
Logger.log(datasets);
}
In [script > resources > advanced google resources] enable the BigQuery v2 API
Try to run the function, you will get an OAuth authorization pop-up and will need to grant your script access to BigQuery
You will then get an error that says that the BigQuery API needs to be enabled in the cloud console: Access Not Configured. BigQuery API has not been used in project 111111111111 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/bigquery.googleapis.com/overview?project=111111111111 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. (line 5, file "Code")
Enable the BigQuery API in the google cloud console as instructed (tip: when you follow the URL click on "dashboard" in the left column, then "enable APIs" at the top) and verify that it's enabled
Go back to the apps script and re-run the function, you will get the same error that the BQ API needs to be enabled.
Since the error says that it may take a few minutes to propagate, go have some food, come back, try again, see the same error. I have waited overnight with no change. Normally it takes less than 10 seconds.
I have tried the above using my corporate G-suite account as well as my personal account and run into the same problem both ways.
Are others seeing the same? Where does one go for help?
This issue now appears resolved. I ended up having to sign up for silver support, pay $150, create a cloud support ticket, and eventually I got the reply "I've looked at this issue with our backend team. This is an incident that was reported today, and you're not the only one affected by it. It's a known issue. I will get back to you in a few hours with more updates." Oh great, I'm glad I got to pay to get that info :-(. So far the lack of support with GCP is confirming that I should continue spending my money elsewhere...

Accessing the Administrator Audit Log via Google Script

Despite fervent searches, I don't believe I have come up with quite the results I am needing. Within the Google Apps for Business Administrator console, under "Reports" there is the "Audit Log." This audit log nearly displays everything I need; however, I am needing the actual name of the file instead of the fileID provided in the report.
The ultimate endgame is to generate, via Google Script, an automated daily report that gives this same data to a few users daily. Is there any means by which I may access this data? I have been pouring over the APIs, and perhaps I've missed something, but I don't feel that I've found what I needed.
Any thoughts and help would be greatly appreciated. Thank you for your time and considerations.
This is possible using the Google Apps Admin Audit API. This uses OAuth and that is a bit tricky to setup sometimes. You can see the set up process in this video that we did. Except as the example shows, instead of the YouTube APIs enable the Apps Reporting and Audit APIs in the API Console.
I built out a simple example of this that you can see in operation. Access this URL after having been logged in as the domain admin. It will automatically create a Spreadsheet in your Drive with the latest Audit logs exported. This is a web app that is deployed as "Run as user".
I've open sourced this Github here. You should substitute in the right OAuth2 Client ID/Secret. The code is pretty rough so you'll want to clean it up. I am selectively logging a few columns but if you look at the API docs, there are other things you can log as well.
Once the OAuth token is set up you can have this run on a trigger as well as long as you refresh the token.
Hope this helps.