繁体   English   中英

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

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

我收到错误代码“ 403:配额错误:超出用户速率限制”,并且对Google Analytics Management API(v3)的批处理请求指向管理视图(配置文件):patch

我知道文档中的配额限制 ,这表明我达到了每天50个查询的写入限制。

但是,这仅在批处理请求中发生。 这样的个人通话:

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); });

  });

仍然带有200er代码

对于批处理请求,添加到批处理中的第一个请求始终会成功,而随后的所有请求都将抛出403er。

批处理请求的代码如下所示:

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); 
          }
      );
};

完整的错误消息是这样的:

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

我猜您正在达到1.5 qps的写限制。 由于您一次要发送两个以上的写入。 因此,第一次写入成功,然后所有其他写入失败。

暂无
暂无

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

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