[英]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.