我收到指向对management views (profiles): patch的Google Analytics Management API(v3)的批量请求的错误代码“ 403:配额错误:超出用户速率限制”。
我从文档中了解到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."}}"
答案 0 :(得分:0)
我猜您正在达到1.5 qps的写限制。由于您一次要发送两个以上的写入。因此,第一次写入成功,然后所有其他写入失败。