Accept or reject revisions

GroupDocs.Comparison Cloud allows to accept or reject revisions from Word document and save the result.

The following code sample demonstrates how to accept all revisions.

API usage

There are steps that usage of GroupDocs.Comparison Cloud consists of:

  1. Upload input documents into cloud storage
  2. Call API method with options
  3. Download comparison result document from storage (if any)

Steps 1 and 3 are storage operations, please refer to this File API documentation for usage details.

Swagger UI lets you call this REST API directly from the browser.

cURL example

// First get JSON Web Token
// Please get your Client Id and Client Secret from Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
curl -v "" \
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// cURL example to get document information
curl -v "" \
-X PUT \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer <jwt token>"
-d "{
  'SourceFile': {
    'FilePath': 'source_files/word/source_with_revs.docx'
  'Revisions': [
      'Id': 0,
      'action': 'Accept'
      'Id': 1,
      'action': 'Accept'
  'OutputPath': 'output/result.docx'
  "href": "",
  "rel": "output/result.docx",
  "type": "file",
  "title": "result.docx"

SDK example

Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of GroupDocs.Comparison Cloud SDKs along with working examples, to get you started in no time. Please check Available SDKs article to learn how to add an SDK to your project.

// For complete examples and data files, please go to
string MyClientSecret = ""; // Get ClientId and ClientSecret from
string MyClientId = ""; // Get ClientId and ClientSecret from

var configuration = new Configuration(MyClientId, MyClientSecret);
var apiInstance = new ReviewApi(configuration);

var options = new ApplyRevisionsOptions
    SourceFile = new FileInfo {FilePath = "source_files/word/source_with_revs.docx" },
    OutputPath = "output/result.docx"

var revisions = apiInstance.GetRevisions(new GetRevisionsRequest(options.SourceFile));

foreach (var revision in revisions)
    revision.Action = RevisionInfo.ActionEnum.Accept;

options.Revisions = revisions;

var response = apiInstance.ApplyRevisions(new ApplyRevisionsRequest(options));

Console.WriteLine("ApplyRevisions: Output file link: " + response.Href);

// For complete examples and data files, please go to
String MyClientSecret = ""; // Get ClientId and ClientSecret from
String MyClientId = ""; // Get ClientId and ClientSecret from

Configuration configuration = new Configuration(MyClientId, MyClientSecret);
ReviewApi apiInstance = new ReviewApi(configuration);

FileInfo sourceFileInfo = new FileInfo();

ApplyRevisionsOptions options = new ApplyRevisionsOptions();

GetRevisionsRequest request = new GetRevisionsRequest(sourceFileInfo);
List<RevisionInfo> rInfos = apiInstance.getRevisions(request);

for (RevisionInfo rInfo : rInfos) {
Link response = apiInstance.applyRevisions(new ApplyRevisionsRequest(options));

System.out.println("Output file link: " + response.getHref());

// For complete examples and data files, please go to
use GroupDocs\Comparison\Model;
use GroupDocs\Comparison\Model\Requests;

$ClientId = ""; // Get ClientId and ClientSecret from
$ClientSecret = ""; // Get ClientId and ClientSecret from

$configuration = new GroupDocs\Comparison\Configuration();

$apiInstance= new GroupDocs\Comparison\ReviewApi($configuration);

$sourceFile = new Model\FileInfo();
$options = new Model\ApplyRevisionsOptions();

$revisions = $apiInstance->getRevisions(new Requests\GetRevisionsRequest($sourceFile));
for ($i=0; $i < count($revisions); $i++) { 
$request = new Requests\ApplyRevisionsRequest($options);
$response = $apiInstance->applyRevisions($request);

echo "Output file link: ", $response->getHref();

// For complete examples and data files, please go to
global.comparison_cloud = require("groupdocs-comparison-cloud");

global.clientId = "XXXX-XXXX-XXXX-XXXX"; // Get ClientId and ClientSecret from
global.clientSecret = "XXXXXXXXXXXXXXXX"; // Get ClientId and ClientSecret from

global.reviewApi = comparison_cloud.ReviewApi.fromKeys(clientId, clientSecret);

try {
 let source = new comparison_cloud.FileInfo();
 source.filePath = "source_files/word/source_with_revs.docx";

 let options = new comparison_cloud.ApplyRevisionsOptions();
 options.sourceFile = source;
 options.outputPath = "output/result.docx";
 let request = new comparison_cloud.GetRevisionsRequest(source);  
 let revisions = await reviewApi.getRevisions(request);

 revisions.forEach(revision => {
  revision.action = comparison_cloud.RevisionInfo.ActionEnum.Accept;
 options.revisions = revisions;

 let response = await reviewApi.applyRevisions(new comparison_cloud.ApplyRevisionsRequest(options));
 console.log("Output file link: " + response.href);
} catch (error) {

# For complete examples and data files, please go to
import groupdocs_comparison_cloud

client_id = "XXXX-XXXX-XXXX-XXXX" # Get ClientId and ClientSecret from
client_secret = "XXXXXXXXXXXXXXXX" # Get ClientId and ClientSecret from

api_instance = groupdocs_comparison_cloud.ReviewApi.from_keys(client_id, client_secret)

source = groupdocs_comparison_cloud.FileInfo()
source.file_path = "source_files/word/source_with_revs.docx"
options = groupdocs_comparison_cloud.ApplyRevisionsOptions()
options.source_file = source
options.output_path = "output/result.docx"

revisions = api_instance.get_revisions(groupdocs_comparison_cloud.GetRevisionsRequest(source))

for revision in revisions:
    revision.action = "Accept"

options.revisions = revisions

response = api_instance.apply_revisions(groupdocs_comparison_cloud.ApplyRevisionsRequest(options))

print("Output file link: " + response.href)

# For complete examples and data files, please go to
require 'groupdocs_comparison_cloud'

$client_id = "XXXX-XXXX-XXXX-XXXX" # Get ClientId and ClientSecret from
$client_secret = "XXXXXXXXXXXXXXXX" # Get ClientId and ClientSecret from

api_instance = GroupDocsComparisonCloud::ReviewApi.from_keys($client_id, $client_secret)

source =
source.file_path = "source_files/word/source_with_revs.docx"

options =
options.source_file = source
options.output_path = "output/result.docx"

request =    
revisions = apiInstance.get_revisions(request)

for revision in revisions do
    revision.action = "Accept"

options.revisions = revisions

response = apiInstance.apply_revisions(

puts("Output file link: " + response.href)