【问题标题】:403: Quota Error: User Rate Limit Exceeded witht Batch Request403:配额错误:批量请求超出用户速率限制
【发布时间】:2019-06-02 09:05:59
【问题描述】:

我收到错误代码“403: Quota Error: User Rate Limit Exceeded”,对指向 management views (profiles): patch 的 Google Analytics Management API (v3) 的批量请求。

我从文档中了解到quota limits,这表明我达到了每天 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."}}"

【问题讨论】:

    标签: javascript google-api google-analytics-api google-api-console


    【解决方案1】:

    我猜你正在达到 1.5 qps 的写入限制。由于您一次要批量发送 2 次以上的写入。所以第一次写入成功然后所有其他写入失败。

    【讨论】:

    • 我的印象是 Google 库自己处理批处理请求的写入限制,因为我在有关批处理请求的文档中找不到与写入限制相关的任何内容。你能给我指出一个如何处理这个问题的来源吗?
    • 如果这是预期行为(1.5 QPS 和每日限制 50),我想知道管理端点是什么。如果我只有三个需要更改的帐户,我不妨使用 Google Analytics(分析)后端。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-27
    • 2019-11-01
    • 2015-04-24
    • 2017-07-22
    • 2015-08-19
    • 2014-06-27
    相关资源
    最近更新 更多