Node.js 错误:使用googleapis节点模块时,多部分中缺少Body属性
我正在使用驱动器版本2将新文件插入谷歌驱动器。 使用client.files.insert函数将新文件插入google驱动器 我得到以下错误 错误:多部分中缺少主体属性Node.js 错误:使用googleapis节点模块时,多部分中缺少Body属性,node.js,request,google-drive-api,google-apis-explorer,Node.js,Request,Google Drive Api,Google Apis Explorer,我正在使用驱动器版本2将新文件插入谷歌驱动器。 使用client.files.insert函数将新文件插入google驱动器 我得到以下错误 错误:多部分中缺少主体属性 var auth = new googleapis.OAuth2Client(); auth.setCredentials({ access_token: 'accesskey' }); googleapis.discover('drive', 'v2').execute(function(err, client) {
var auth = new googleapis.OAuth2Client();
auth.setCredentials({
access_token: 'accesskey'
});
googleapis.discover('drive', 'v2').execute(function(err, client) {
client.drive.files.insert({ title: 'Test', mimeType: 'application/json' })
.withMedia('application/json', "Hello world")
.withAuthClient(auth)
.execute(function(error,result){
if(error){
console.log(error);
}else{
console.log(result);
}
});
上述代码在文档中:
有人能帮我吗 确保已启用驱动器API: 去医院。 选择一个项目。 在左侧边栏中选择API&auth。 在可用API列表中查找驱动器API,并将其状态设置为“开”。