Document Comparison is a process that will compare two documents and output a document with revisions, or differences, between the two. It requires that both documents are Microsoft Office documents and that your server is a Windows server with a Microsoft Office enabled PrizmDoc Viewer license.
The following steps will walk you through the document comparison process using the PAS API. Refer to the PAS Document Comparison API section for more detailed information.
Examples in this topic:
Issue a POST request with the body of the request containing JSON formatted ‘source’ object. The source.type property can be a “document”, “url”, or “upload”.
Example |
Copy Code
|
---|---|
POST http://localhost:3000/ViewingSession ViewingSession POST Body Content-Type: application/json { "source": { "type": "comparison", "original": { "type": "document", "fileName": "original.docx" }, "revised": { "type": "url", "url": "http://mysite.com/documents/revised.docx" } } } |
Example |
Copy Code
|
---|---|
200 OK Content-Type: application/json { "viewingSessionId": "{viewingSessionId}" } |
Issue a POST as described below to create a viewingSession with no documents specified:
Example |
Copy Code
|
---|---|
POST http://localhost:3000/ViewingSession
|
Example |
Copy Code
|
---|---|
Content-Type: application/json { "source": { "type": "upload", "displayName": "myFile.doc" } } |
Example |
Copy Code
|
---|---|
200 OK Content-Type: application/json { "viewingSessionId": "{viewingSessionId}" } |
Issue a PUT as described below to upload a file to an existing viewingSession:
Example |
Copy Code
|
---|---|
PUT http://localhost:3000/v2/viewingSessions/{viewingSessionID}/sourceFile/original
|
Example |
Copy Code
|
---|---|
{ Binary Document Data } |
Example |
Copy Code
|
---|---|
200 OK |
Issue a POST as described below to create a viewingSession with no documents specified:
Example |
Copy Code
|
---|---|
POST http://localhost:3000/ViewingSession
|
Example |
Copy Code
|
---|---|
Content-Type: application/json { "source": { "type": "upload", "displayName": "myFile.doc" } } |
Example |
Copy Code
|
---|---|
200 OK Content-Type: application/json { "viewingSessionId": "{viewingSessionId}" } |
Issue a PUT as described below to upload a file to an existing viewingSession:
Example |
Copy Code
|
---|---|
PUT http://localhost:3000/v2/viewingSessions/{viewingSessionID}/sourceFile/revised
|
Example |
Copy Code
|
---|---|
{ Binary Document Data } |
Example |
Copy Code
|
---|---|
200 OK |
Issue a GET as described below using the viewingSessionId obtained from the POST request to create a viewing session:
Example |
Copy Code
|
---|---|
GET http://localhost:3000/v2/viewingSessions/{viewingSessionId}/sourceFile/original?myFile
|
Example |
Copy Code
|
---|---|
200 OK Content-Type: application/msword Content-Disposition: attachment; filename=myFile.pdf { Binary Document Data } |
Issue a GET as described below using the viewingSessionId obtained from the POST request to create a viewing session:
Example |
Copy Code
|
---|---|
GET http://localhost:3000/v2/viewingSessions/{viewingSessionId}/sourceFile/revised?myFile
|
Example |
Copy Code
|
---|---|
200 OK Content-Type: application/msword Content-Disposition: attachment; filename=myFile.pdf { Binary Document Data } |
Issue a POST request with the body of the request containing JSON formatted ‘source’ object. The source.type property can be a “document”, “url”, or “upload”.
Example |
Copy Code
|
---|---|
POST http://localhost:3000/ViewingSession
|
Example |
Copy Code
|
---|---|
Content-Type: application/json { "source": { "type": "comparison", "original": { "type": "document", "fileName": "original.docx" }, "revised": { "type": "url", "url": "http://mysite.com/documents/revised.docx" } } } |
Example |
Copy Code
|
---|---|
200 OK Content-Type: application/json { "viewingSessionId": "{viewingSessionId}" } |
Issue a GET request using the viewingSessionId from Step One above. Each request will return up to a limit of 100 revision data items by default. The GET request will contain a continueToken if any additional data may be available after the response is returned. You can use that continueToken in the next request to continue getting data after the ones you have already seen:
Example |
Copy Code
|
---|---|
GET http://localhost:3000/v2/viewingSessions/{viewingSessionId}/revisionData
|
Example |
Copy Code
|
---|---|
200 OK Content-Type: application/json Content-Encoding: gzip { "changes": [], "continueToken": "{continueToken}", "continueAfter": 500 } |
Issue a GET request using the viewingSessionId from Step One above and with the continueToken. It is good to wait 500ms as mentioned in the GET response from the second step as well:
Example |
Copy Code
|
---|---|
GET http://localhost:3000/v2/viewingSessions/{viewingSessionId}/revisionData?continueToken={continueToken}
|
Example |
Copy Code
|
---|---|
200 OK
Content-Type: application/json
Content-Encoding: gzip
{
"changes": [{revisions}]
}
|