I'm trying to set permissions to several files in Google Drive using their API. I'd like to batch the insert permission API
So far, this is what I tried:
var httpBatch = gapi.client.newHttpBatch();
for(var fileIndex = 0; fileIndex < files.length; ++fileIndex) {
httpBatch.add(
gapi.client.request({
path: 'drive/v2/files/' + files[fileIndex].id + '/permissions',
method: 'POST',
params: {
value: 'some_user@gmail.com',
type: 'user',
role: 'writer'
}
})
);
}
httpBatch.execute(callback);
I also tried to use the API "gapi.client.drive.permissions.insert" but I can't find a a way to do the batching properly with it.
I really hope this is possible. Anyway I would appreciate any help on this. Thanks a lot.