我正在使用驱动器版本 2 将新文件插入到 google-drive。 使用 client.files.insert() 函数将新文件插入 Google 云端硬盘
我收到以下错误 错误:多部分中缺少正文属性。
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);
}
});
以上代码位于文档中:https://github.com/google/google-api-nodejs-client/
谁能帮帮我!!
最佳答案
确保您已启用 Drive API:
- 转到Google Developers Console 。
- 选择一个项目。
- 在左侧边栏中选择API 和身份验证。
- 在可用 API 列表中找到Drive API,并将其状态设置为开启。
关于node.js - 错误: Body attribute missing in multipart while using googleapis node module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21822473/