2

I'm making several api requests from my server. After reading a bunch of other peoples problems, most say if I include the quotaUser variable as a random value, it should consider each request it's own user. See the request

enter image description here

I'm not sure why i'm recieving this error.

enter image description here

As you can see i'm not even close to my limit.. enter image description here

How can I get past this error? It's as if the quotaUser isn't actually being used.

Thanks for any help.

caden311
  • 972
  • 8
  • 22
  • I ended up following this exponential backoff algorithm. https://developers.google.com/analytics/devguides/reporting/core/v3/errors#backoff that seems to be working well.. But would still like to know why the quotaUser doesn't work. – caden311 Sep 19 '17 at 22:02
  • No real solution still? I'm running into exactly the same problem with the firebase short dynamic links api. Using quoteUser on the url doesn't change anything. – Thijs Koerselman Mar 01 '19 at 20:20
  • @ThijsKoerselman I'm pretty sure I ended up implementing a exponential backing. That fixed it. https://cloud.google.com/storage/docs/exponential-backoff – caden311 Mar 01 '19 at 20:34
  • That is not an option for me unfortunately. I wanted to generate short dynamic links for all users in my database. Without the quoteUser query parameter I can only call the API at 1 request per second – Thijs Koerselman Mar 02 '19 at 17:41

3 Answers3

2

Just encountered this error, and after some digging it appears that these are only used for anonymous requests for public files. From https://developers.google.com/drive/api/v3/query-parameters (the very bottom of the page):

Note: Per-user quotas are always enforced by the Drive API, and the user's identity is determined from the access token passed in the request. The quotaUser and userIp parameters can only be used for anonymous requests against public files.
Femi
  • 64,273
  • 8
  • 118
  • 148
1

Maybe this SO post could help you further.

Here is a discussion from documentation how the quotaUser will be used.

quotaUser

Alternative to userIp.

  • Lets you enforce per-user quotas from a server-side application even in cases when the user's IP address is unknown. This can occur, for example, with applications that run cron jobs on App Engine on a user's behalf.
  • You can choose any arbitrary string that uniquely identifies a user, but it is limited to 40 characters.
  • Overrides userIp if both are provided.
  • Learn more about Capping API usage.

From the answer of the SO post:

If you send a different quotaUser on every request, say a random number, then Google thinks its a different user and will assume that its only one request in the 10 seconds. Its a little trick to get around the ip limitation when running server applications that request everything from the same IP.

MαπμQμαπkγVπ.0
  • 5,887
  • 1
  • 27
  • 65
  • 3
    Yeah what you're saying is exactly what I thought! That's why i'm so confused about it. Because sending quotaUser with a random string doesn't fix my quota issue. Thanks for the information though. – caden311 Sep 20 '17 at 15:37
0

An alternative is to have the "100 requests per 100 seconds per user" limit increased. It is not immediate as you are required to fill in a form with a justification, then Google will accept or deny the limit change request.

https://console.developers.google.com/apis/api/sheets.googleapis.com/overview -> Quotas -> click on the pencil icon next to "Write requests per 100 seconds per user"

Quota table

You can increase your quota to 1000 requests per 100 seconds per user.

sherwoor
  • 185
  • 6