How do I get exportLinks for revision in Google Drive API

I use Google Apps scripts to try to get the exportLinks list for different versions of Google Drawing. The following code reproduces the problem. To try, call getRevisionHx with the drawing ID.

//Google oAuth function googleOAuth_(name,scope) { var oAuthConfig = UrlFetchApp.addOAuthService(name); oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope); oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken"); oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken"); oAuthConfig.setConsumerKey("anonymous"); oAuthConfig.setConsumerSecret("anonymous"); return {oAuthServiceName:name, oAuthUseToken:"always"}; } function getRevisionHx(resource_id){ var scope = 'https://www.googleapis.com/auth/drive'; var myKey = KEY_DELETED_FROM_SAMPLE_CODE; var fetchArgs = googleOAuth_('drive', scope); fetchArgs.method = 'GET'; var url = "https://www.googleapis.com/drive/v2/files/" + resource_id + "/revisions?key=" + myKey; var urlFetch = UrlFetchApp.fetch(url, fetchArgs); ... //snip } 

In snip, urlFetch succeeded, and it has a list of changes with exportLinks for each of them. If I take one of these export links and download it using a web browser, it always retrieves the latest version of the document, not the specified revision. Is this a mistake or am I doing something wrong?

In other words, all of the above code is working fine (the API call succeeds and returns the expected one), but the returned exportLink URLs do not indicate the version they are talking about.

+6
source share
1 answer

The same result was reproduced.

I will tell you about it. Sorry for the inconvenience.

0
source

Source: https://habr.com/ru/post/948011/


All Articles