jbra95
jbra95

Reputation: 909

Get size of files with Google Drive API v3

I'm extracting some data from the drive API:

response = service.files().list(q=q_parameter, spaces='drive', fields='nextPageToken, files(id, name,mimeType, webViewLink, owners, capabilities, createdTime, modifiedTime, size)', pageToken=page_token).execute()

I'm saving the response in a JSON file, but the size is not being saved...

JSON response

Drive API documentation here.

Any ideas? Thanks.

Upvotes: 0

Views: 2146

Answers (2)

jbra95
jbra95

Reputation: 909

I have found the problem! Everything works fine. The native drive files don't take up space.

Upvotes: 1

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117281

Use fields * and it will download all of the metadata. If you hadent set up the limitation fields correctly the data would have returned null

response = service.files().list(q=q_parameter, spaces='drive', fields='*', pageToken=page_token).execute()

Upvotes: 2

Related Questions