Get the revision history of a resource using DocsList API

To get the revision history of your resource in your Google Docs using Google Apps Script, you can use Google DocsList API with Google oAuth and URLFetch App.


Here is a quick code which will return the revision history entries in the form of JSON. You can use this JSON to get the different fields in revision history.

//Get revison history

// resource_id is the ID of the resource from Google Docs

function getRevisionHistory(resource_id){


  var scope = '';

  //Get Google oAuth Arguments

  var fetchArgs = googleOAuth_('docs', scope);

  //Set the fetch method

  fetchArgs.method = 'GET';

  //Feed URL

  var url = scope + 'default/private/full/'+resource_id+'/revisions?v=3&alt=json';

  var urlFetch = UrlFetchApp.fetch(url, fetchArgs);

  //Get the json of revision history entry

  var jsonFeed = Utilities.jsonParse(urlFetch.getContentText()).feed.entry;

  //return the revison history feed

  return jsonFeed


//Google oAuth

//Used by getRevisionHistory

function googleOAuth_(name,scope) {

  var oAuthConfig = UrlFetchApp.addOAuthService(name);






  return {oAuthServiceName:name, oAuthUseToken:"always"};