title: Change file permissions to Google Drive with Javascript
body: <p>This is the first time I write. I come to you for the marvelous solutions to all the problems you find.</p>
  
  <p>I built my site Google Drive, with its SDK for Javascript. Everything works incredibly well, only I have a problem. I need to change the permissions of a file to "publish, for everyone without identifying" the files that I want.</p>
  
  <p>I looked at the sdk Google Drive is:</p>
  
  <p><a href="https://developers.google.com/drive/v2/reference/permissions/update" rel="nofollow">https://developers.google.com/drive/v2/reference/permissions/update</a></p>
  
  <p>But I find it very complex to understand, do not know where I get the variables.</p>
  
  <pre><code>function updatePermission(fileId, permissionId, newRole) {
    // First retrieve the permission from the API.
    var request = gapi.client.drive.permissions.get({
      'fileId': fileId,
      'permissionId': permissionId
    });
    request.execute(function(resp) {
      resp.role = newRole;
      var updateRequest = gapi.client.drive.permissions.update({
        'fileId': fileId,
        'permissionId': permissionId,
        'resource': resp
      });
      updateRequest.execute(function(resp) { });
    });
  }
  </code></pre>
  
  <p>I do not understand where I draw the variables:
  -permissionId
  -newRole (for set super public file)</p>
  
  <p>Currently I have all the information of the files (id, urls ...), but I find it very complex to change permissions.</p>
  
  <p>I searched a lot for Google, but can not find any example to locate a file in public.</p>
  
  <p>Does anyone know? ... I really appreciate the heart.</p>
  
  <p>Currently I upload the files to the user's account without any problem, I can also play the files without problem. I just have this little thing, haha.</p>