在下面的代码中,我尝试通过Google API Node.js client
创建一个google驱动器文件夹var fileMetadata = {
'name' : 'Project plan',
'mimeType' : 'application/vnd.google-apps.drive-sdk'
};
// what is fields and resource key being used
drive.files.create({
resource: fileMetadata,
fields: 'id'
}, function(err, file) {
if(err) {
// Handle error
console.log(err);
} else {
console.log('File Id: ', file.id);
}
});
fields: id
参数代表什么?
答案 0 :(得分:0)
REST API的响应仅包含您指定的fields
https://developers.google.com/drive/v3/web/performance
请求部分回复:以下请求也是如此 资源使用fields参数来显着减少数量 返回的数据。
https://www.googleapis.com/demo/v1?key=YOUR-API-KEY&fields=kind,items(title,characteristics/length)
虽然client API中未记录fields
,但客户端中未在本地处理的任何参数均为forwarded through in the HTTP request.