Reputation: 49
I want to create file copies in a bulk with one call, now I am using Google Drive Rest API for copying files.
Code:
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 });
});
}
How can I achieve my goal?
Reference: https://developers.google.cn/drive/api/v2/reference/files/copy
Upvotes: 0
Views: 341
Reputation: 116996
Have you consulted the documentation? Did you read the part where it says
Files.copy is singular one file per call.
The Batching endpoint might be a solution but that depends upon what you qualify as one call.
Batching will let you nest multiple copy calls into a single HTTP Request, but if you are trying to get around the quota limitations this will not help you as the quota is based upon each of the calls with in the batch request.
Upvotes: 2