title: Batch insert permissions API with Google Drive API in Javascript
body: <p>I'm trying to set permissions to several files in Google Drive using their API.
  I'd like to batch the <a href="https://developers.google.com/drive/v2/reference/permissions/insert" rel="nofollow">insert permission API</a></p>
  
  <p>So far, this is what I tried:</p>
  
  <pre><code>var httpBatch = gapi.client.newHttpBatch();
  
  for(var fileIndex = 0; fileIndex &lt; 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);
  </code></pre>
  
  <p>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.</p>
  
  <p>I really hope this is possible. Anyway I would appreciate any help on this. Thanks a lot.</p>