Search code examples
permissionsgoogle-drive-apiacl

Google Drive API insert permission only returns id


I'm using this request to grant user permission for a folder

https://www.googleapis.com/drive/v2/files/{{id}}/permissions?sendNotificationEmails=true&fields=emailAddress,id,name,role,type,value

but it returns only the id field

{ id: '0123456789876543210' } like this

How can I get all other information in response ? or, is there any BUG in Drive REST API ?


Solution

  • From the documentation here https://developers.google.com/drive/v2/reference/permissions/list:

    The return resource is in the following form:

    {
      "kind": "drive#permissionList",
      "etag": etag,
      "selfLink": string,
      "items": [
        permissions Resource
      ]
    }
    

    Which means you would need to specify your query field param as

    items(emailAddress,id,name,role,type,value)
    

    Rather than:

    emailAddress,id,name,role,type,value
    

    Alternatively, you can leave the fields param out to ensure you actually have the information available. Hope that helps!