直接从文档中获取
handle errors
401:无效凭据
无效的授权标头。您正在使用的访问令牌已过期或无效。
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization",
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
建议的操作:使用长寿命刷新令牌刷新访问令牌。如果失败,请引导用户通过OAuth流,如中所述
Authorizing Your App with Google Drive
.
Batch
文档
var searchRequest = function(name) {
return gapi.client.request({
'path': 'plus/v1/people',
'params': {'query': name}
});
};
var searchAlvin = searchRequest('Alvin');
var searchSimon = searchRequest('Simon');
// Adding just the request
batch.add(searchAlvin);
// Adding the request with an ID
batch.add(searchSimon, {'id': 'searchSimon'});