3

Searched a bunch and found pages regarding list/get/update revisions, but nothing about actually making a new revision. Instructions made it sound like if I set published: true in the requestBody it would create a new revision for the current state of the file. Wrote some quick test code in node:

async function testGlg() {
await setupGoogleAuth()
const fileId = '1mVYwVAjDVcR-0bvxLaHzdToy6gx38B5Oe4CZhnRJuJo'
const r = await drive.revisions.list({
    fileId: fileId,
})
const revisions = r.data.revisions
const latestRevisionId = revisions[revisions.length-1].id
const w = await drive.revisions.update({
    fileId: fileId,
    revisionId: latestRevisionId,
    requestBody: {
        published: true,
    },
})

but that didn't appear to do anything. Also, I couldn't find a way to get the name of a revision as it's displayed in chrome or to set it via the api.

1 Answers1

1

The Revisions API returns you the history of changes performed on a document

  • You cannot create a new revision with the Revisions API, since revisions are being created automatically in the background - as a response to a change in a document.

  • You can edit the document either via UI or - depending on the document type - with an API, like e.g. the Google Sheets API in case of spreadsheets

  • The method Revisions: update allows you to modify how an existing revision shall be handled (e.g. either it shall be kept forever), but it does not change the revision content.
ziganotschka
  • 25,866
  • 2
  • 16
  • 33
  • Is there a way to *cut* the doc at the current state so that any future changes make a new revision automatically? Also, I didn't see a way to change the name of a revision in the api. – Kevin Riley Jan 04 '21 at 18:20
  • A change of a document always makes new revisions automatically. – ziganotschka Jan 04 '21 at 20:47