Google-api-nodejs-client: googleapi.drive.files.get returns only a few fields of each file

Created on 11 Aug 2017  路  5Comments  路  Source: googleapis/google-api-nodejs-client

I tried to use googleapi.drive('v3').files.get, and in the response.files list, each object only contains four fields: name, id, kind and mime_type.

However, the API should return a lot more than those. (e.g. the url and owner)

Thanks!

fyi: https://developers.google.com/drive/v2/reference/files/get

Most helpful comment

For anyone looking here who wants to see all fields for testing you can send in '*' for the fields param to get all fields back.

All 5 comments

/cc @erickoledadevrel

It's not clearly documented, but this is working as intended. You need to explicitly set the fields parameter and list the names of the fields you want returned.

FYI @sqrrrl.

For anyone looking here who wants to see all fields for testing you can send in '*' for the fields param to get all fields back.

For anyone looking here who wants to see all fields for testing you can send in '*' for the fields param to get all fields back.

To anyone using API V3 this is still valid.

example:
getfile = service.files().get(fileId='FILE ID', supportsAllDrives=True, acknowledgeAbuse=None, fields='*').execute()

Since the syntax on how to specify just the desired fields was not clear to me following the documentation I leave here an example. Just create a string and separate them by commas:
let request = gapi.client.drive.files.get({ fileId: 'FILE ID', fields: 'name, trashed' });

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ovaris picture ovaris  路  3Comments

JustinBeckwith picture JustinBeckwith  路  3Comments

ashishbajaj99 picture ashishbajaj99  路  3Comments

lowagner picture lowagner  路  3Comments

oliverjessner picture oliverjessner  路  3Comments