Google Drive SDK - google-drive-api

I am developing an app in C++ which will run in a Windows desktop environment This will be distributed to a number of customers and I need to store log files from the customers in a central location where I can access them. Is Google drive a suitable platform for this and if so what is the best approach? Should I be looking at an Application Owned Account for example? Also I am concerned by the paragraph in the Google documentation:
"Note that there are limits on the number of refresh tokens that will be issued; one limit per client/user combination, and another per user across all clients. You should save refresh tokens in long-term storage and continue to use them as long as they remain valid. If your application requests too many refresh tokens, it may run into these limits, in which case older refresh tokens will stop working"
How long does a token remain valid for and what are the limits on refresh tokens?
Best regards
Trevor

You could use google drive for this, its not a bad idea really. But since its only log files you are storing and they are all owned by the application your not going to be needing to bother with user Oauth2. You could do it with a google drive service account. This way the application owns the account and they are just uploading data to it.
https://developers.google.com/drive/service-accounts

Related

Bandwidth Quota for Google Apps Script

This morning we got a couple of errors from Google Apps script saying:
Exception: Bandwidth quota exceeded...
Try reducing the rate of data transfer.
Our Google Apps Script (GAS) programs mainly look at Gmail, do some processing, access Google Maps some, and transfer data back and forth between GAS/GCP and an app hosted on another platform.
However, accessing Gmail doesn't seem to be what this is talking about. "Bandwidth quota" would seem to indicate too much data is being transferred into and out of the Google servers via Google Apps Script. We do transfer a fair amount of data back and forth to an app hosted on another platform on the Internet, such as Amazon Web Services.
However, we don't see that there is a "Bandwidth quota" on the Google Services Quotas page. AND around the time we got this error this morning, we weren't accessing Gmail nor transferring data back and forth outside of GCP any more than usual. Probably less.
Does anyone know what this quota is, where we can find it, and how we can possibly bump it up, even if we need to pay for it?
I looked at our Google Cloud Platform (CCP) Console Quotas (https://console.cloud.google.com/iam-admin/quotas) and we are well below any usage limit, and see none that are about a "Bandwidth Quota".
Thank you!
UPDATE 29 March 2022 - After more than a month of having zero of these messages, this evening we are seeing at least 10 of them. Some facts:
The "bandwidth quota exceeded" errors are only happening when calling the APIs for one particular external app hosted on AWS-like servers. They do not occur when calling drive, maps, etc. or any other APIs.
Today has been a lower-volume day & evening for our app than many are. So, this makes no sense why we would get these errors this evening and not other days.

Google drive OR Google cloud storage for a business web app

I'm a voice-over artist. I am creating a web app in which the client can make orders & upload video/sound/image/text files, I download these files to edit them then i upload the edited files & allow the client to download them.
Which is better for this purpose?
Taking in consideration
I want to allow the client to preview the edited file (video) in the
browser
Security
File privacy [I mean no one can reach the file except the client who made the order]
Performance
Price
There is no definitive answer to your question.
It confuses many customers that two, such seemingly functionally similar services, are available.
That said -- generally -- for applications where a service (your web app) is the intermediary, Google Cloud Storage (GCS) is the more appropriate solution.
GCS is a lower-level service than Drive and so you'll have a little more work to do to integrate it but it provides richer functionality too particularly with regards authorization and being able to provide more specificity about who can do what. Lastly, GCS enables so-called "Signed URLs" that would e.g. permit you to provide your customers with a secure and time-bound URL where they may upload content.
One possibly determining feature is that a Google Drive account is oriented around an individual (generally human) user (e.g. you) and your Google Drive does not permit other users to upload files; only you can create files in your Drive account although you can then share these with others.
I hope this helps you decide which service is best-suited to your needs. GCS is a very widely used service and is well-documented. You should be able to find plenty of guidance to help you develop a solution using it.

Google Cloud Vision API from Google Apps Script?

I've been accessing the Google Cloud Vision API from a script in a Google Sheet using UrlFetch and the REST API.
Until I got "UrlFetch failed because too much upload bandwidth was used" I didn't even know there was a quota on UrlFetch!
Is the a way to access Google Cloud APIs from a Google Apps Script so I can dodge the quota?
Quotas protect the users of Google services by preventing unforeseen spikes in usage, on the benefit of both the user (who might get unexpected bills if the quota is related to a payed resource) and the community (who will have more resourcesa available, as they will not be monopolized by users that are making an excesive use of them).
That is the reason why quotas cannot be exceeded, although depending on the service (and specific quota) you are using, you may be able to request a quota increase by following the documented procedure or contacting the support team of the product in use.
Finally, in order to identify which is the quota that you are currently hitting, refer to this documentation page where you will be able to find the quotas for URL Fetch, which as of February 2018 are:
As a side note, you have to take into account that these quotas are refreshed at the end of a 24-hour window, so your quota will be resetted to 0 every day. Moreover, this is also on a per-user basis, so you can work around this limitation by spreading your URLFetch usage across several users and days, if that is something that you can manage.

How the quotas of google drive sdk works?

I am starting to develop a windows-like client google drive client for linux.
I have some problems that I am solving yet, but one no technical question are worrying me.
The drive sdk has request limit, I want open my app like other options (for example gdrive ) but the request limit will avoid general availability.
I need put a personal id, but I suppose that is not the way to publish the app.
How other options solve this problem?
Google Drive Apps have a "courtesy limit" of 10 million requests per day I believe.
I cannot imagine a situation in the near future where you will run into issues.
If so this is often referred to in the world of software development as "the good problem".
Google will no doubt allow you to scale if your app provides value to users and needs the bandwidth.

Is it possible to scale Google Apps Script?

If I write an entire web app in GAS and then it gets popular and it starts receiving a thousand requests per second. Is there any way to either pay Google to handle it, or host my GAS app on non-Google infrastructure, in the same way that here does for Google App Engine?
Your GAS script scales up automatically. The only thing that you should be worried about is your code where, if you have locks, thousands of users waiting for a lock will cause delays to the user. Other than that, scaling up shouldn't be a problem. After all, there are possibly millions of scripts being run by different users.
I've never seen Google suggest Apps Script is the tool for that kind of scale. Go to App Engine, do not pass Go, etc.
There is no third-party implementation of the Google Apps Script services. It is, however, a JavaScript implementation on Java (think Rhino) which you can run yourself - or you could run on App Engine and use the Java GData APIs to replace the Apps Script services.
if the App is running under the user account (execute the app as the user accessing the web app) it will consume each user's quotas and use their own account resources (docs, sheets, etc). This would allow for 'unlimited' scalability.
This is just my own view, am I right or totally wrong?