【发布时间】:2021-05-06 10:35:57
【问题描述】:
我想通过一次调用批量创建文件副本,现在我正在使用 Google Drive Rest API 来复制文件。
代码:
copyFileCreation(_id, _fileId, _token) {
console.log({ _id }, { _fileId }, { _token });
fetch(`https://www.googleapis.com/drive/v2/files/${_fileId}/copy`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${_token}`,
'Accept': 'application/json'
},
body: JSON.stringify({
"parents": [{
"id": _id
}],
"title": "Untitle"
}),
}).then(res => res.json()).then(data => {
console.log('copyFileCreation_data', { data });
});
}
我怎样才能实现我的目标?
参考:https://developers.google.cn/drive/api/v2/reference/files/copy
【问题讨论】:
标签: javascript google-api google-drive-api