How to export google docs revision with v3 drive api?

Viewed 1406

How can I export specific version of Google document?

I want to create an exact slice copy of user's gdrive.

The idea is

  1. Get list of head revisions for all files in drive
  2. Download or export every file with exact revision

But for google docs files I can't find an head revision field in /files/list/:

 {
   "id": "1Vsg1U58vXPCGqL2KFAT-cY9ckAIwWxQQ0-49HOPtHzI",
   "name": "Spreadsheet-test-file-1",
   "mimeType": "application/vnd.google-apps.spreadsheet",
   "version": "844"
  },

and when I list all revisions for this file, I get this:

{
 "kind": "drive#revisionList",
 "revisions": [
  {
   "kind": "drive#revision",
   "id": "1",
   "mimeType": "application/vnd.google-apps.spreadsheet",
   "modifiedTime": "2017-07-04T07:21:24.849Z"
  },
  {
   "kind": "drive#revision",
   "id": "2",
   "mimeType": "application/vnd.google-apps.spreadsheet",
   "modifiedTime": "2017-07-04T07:21:24.852Z"
  }
 ]
}

But when I try to download this revision, I get an error Only files with binary content can be downloaded. Use Export with Google Docs files.

I know that API docs says that Google docs can't be downloaded with revisions. But if so, I don't understand how to get the exact slice of the drive?

By the way, I am using the Go library for drive api.

0 Answers
Related