Google REST API v3 - Revisions:list vs “Show more

2020-05-19 08:33发布

问题:

I need to get the detailed list of the revisions for a Google Document.
When using the Google API Explorer on:

GET https://www.googleapis.com/drive/v3/files/{fileId}/revisions

I get only the non-detailed list.

Which is the API to call (or the parameter to set) in order to get something similar to what can be seen by pressing Show more detailed revisions?

Update:
I tried to "sniff" the browser traffic and I realized that Google Drive periodically requests the revision list to the URL:

https://docs.google.com/spreadsheets/d/{fileId}/revisions/history?id={fileId}&start=1&end=-1&zoom_level=0&token={token}

When clicking on Show more detailed revisions, the previous URL becomes:

https://docs.google.com/spreadsheets/d/{fileId}/revisions/history?id={fileId}&start=1&end=-1&zoom_level=1&token={token}

(the zoom_level parameter changes from 0 to 1)
I cannot find anything like that on the API reference, though. It seems that such an URL has to be invoked manually.
Therefore, I manually generated a token for the drive scope, manually checked it in order to keep it fresh and manually invoked that URL, in order to see what happened. Unfortunately, I got the following error on the browser:

Impossibile aprire il file in questo momento.
Verifica l'indirizzo e riprova.

which roughly means:

Unable to open the file at the moment.
Please verify the address and try again.

May somebody point me towards the right direction?

回答1:

In the "Try it" section of the API there is a field called "fields". In there you can select the files you need from the response. If you write "kind,revisions" you will get the complete information or you can use the "fields editor" to select the fields you need.