Search code examples
google-drive-apigoogle-oauthdrive

Not able to get all permissions details from gapi.client.drive.permissions.list in google oauth javascript


I am not able to get all the details from file permissions list in google oauth. please see below. I am really grateful to you guys for trying to help me in this.

I was just using the javascript function from this link https://developers.google.com/drive/v2/reference/permissions/list

DISCOVERY_DOCS = ["[link removed as i couldnt post more than 2 links] /rest"]

SCOPES = '[link removed as i couldnt post more than 2 links] auth/drive'

APIs enabled in project: Google Drive API and Google Plus API

the output im getting is

{  
   "result":{  
      "kind":"drive#permissionList",
      "permissions":[  
         {  
            "kind":"drive#permission",
            "id":"0829568615629092170",
            "type":"user",
            "role":"owner"
         }
      ]
   },
   "body":"{\n \"kind\": \"drive#permissionList\",\n \"permissions\": [\n  {\n   \"kind\": \"drive#permission\",\n   \"id\": \"0829568615629092170\",\n   \"type\": \"user\",\n   \"role\": \"owner\"\n  }\n ]\n}\n",
   "headers":{  
      "date":"Fri, 28 Jul 2017 04:38:32 GMT",
      "content-encoding":"gzip",
      "server":"GSE",
      "content-type":"application/json; charset=UTF-8",
      "vary":"Origin, X-Origin",
      "cache-control":"private, max-age=0, must-revalidate, no-transform",
      "content-length":"129",
      "expires":"Fri, 28 Jul 2017 04:38:32 GMT"
   },
   "status":200,
   "statusText":null
}

the output Im getting from the section "Try this API" in the link https://developers.google.com/drive/v2/reference/permissions/list is

{
 "kind": "drive#permissionList",
 "etag": "\"iqKjQ5Hr8W8KBrJOqxI/FbAMm4yBXAN8WtCcc\"",
 "selfLink": "[link removed as i couldnt post more than 2 links]",
 "items": [
  {
   "kind": "drive#permission",
   "etag": "\"iqKjQ5HW8KBrJOqxI/ddr7iwAeGUpIhy8mSRc\"",
   "id": "0829568615629092170",
   "selfLink": "[link removed as i couldnt post more than 2 links]",
   "name": "raj",
   "emailAddress": "randomemail@gmail.com",
   "domain": "gmail.com",
   "role": "owner",
   "type": "user",
   "photoLink": "[link removed as i couldnt post more than 2 links]",
   "deleted": false
  }
 ]
}

Solution

  • Stop using the v2 API. Switch to v3. Then add fields=* to your request.