简体   繁体   English

403:配额错误:批处理请求超出了用户速率限制

[英]403: Quota Error: User Rate Limit Exceeded witht Batch Request

I'm getting the error code "403: Quota Error: User Rate Limit Exceeded" with batch requests to the Google Analytics Management API (v3) pointing to management views (profiles): patch . 我收到错误代码“ 403:配额错误:超出用户速率限制”,并且对Google Analytics Management API(v3)的批处理请求指向管理视图(配置文件):patch

I'm aware of quota limits from the docs, which suggest that I hit the write limit of 50 queries/day. 我知道文档中的配额限制 ,这表明我达到了每天50个查询的写入限制。

However, this only happens with batch requests. 但是,这仅在批处理请求中发生。 Individual calls like this: 这样的个人通话:

gapi.client.analytics.management.profiles.patch({
        "accountId": "someAccountId",
        "webPropertyId": "some propertyID",
        "profileId": "someProfileId",
        "resource": {
          "excludeQueryParameters" : "someTestValue"
        }
      })
          .then(function(response) {
                      // Handle the results here (response.result has the parsed body).
                      console.log("Response", response);
                    },
                    function(err) { console.error("Execute error", err); });

  });

still come through with a 200er code. 仍然带有200er代码

For the batch request, the first request added to the batch always succeeds, whereas all following ones throw the 403er. 对于批处理请求,添加到批处理中的第一个请求始终会成功,而随后的所有请求都将抛出403er。

The code for batch requests looks something like this: 批处理请求的代码如下所示:

function runQuery(someArray) {

    var batch = gapi.client.newBatch();

    var request = function (query) {

        return gapi.client.request({
          //For demonstration purposes only. Imagin "path" gets adapted to the individual API calls
          "path" : "https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/profiles/profileId",
          "method" : "PATCH",
          "body" :  {
            "excludeQueryParameters" : "someTestValue1"
          }
        });
    }

    //Add to Batch    
    someArray.forEach(function(el) {
          batch.add(request(el))
    });

    //Execute Batch Request
    batch
      .then(function(response) {
            console.log("Response", response);
          },
          function(err) { console.error("Execute error", err); 
          }
      );
};

The full error message is this: 完整的错误消息是这样的:

body: "{"error":{"errors":[{"domain":"global","reason":"userRateLimitExceeded","message":"Quota Error: User Rate Limit Exceeded."}],"code":403,"message":"Quota Error: User Rate Limit Exceeded."}}"

I'm guessing you are hitting the 1.5 qps write limit. 我猜您正在达到1.5 qps的写限制。 Since you are sending more than 2 writes at a time in a batch. 由于您一次要发送两个以上的写入。 So the first write succeed then all other writes fails. 因此,第一次写入成功,然后所有其他写入失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM