-
Notifications
You must be signed in to change notification settings - Fork 8
Difference
As a document changes, it is useful for users to understand the changes between versions. The Difference API allows you to generate a visual representation of the difference and a summary of the changes.
Operation |
---|
Difference between a version and its previous version within a document |
Difference between a version and another version within a document |
If the difference feature is available for a document, the Document GET will return a "difference-previous-version" link and a "difference" link.. The Document Difference feature must be enabled on your account and on the workspace the document resides in.
You can create a difference between a version and its previous version within a document. The Difference API can return a PDF representation of both versions, with differences highlights AND can return a statistical summary of those difference.
GET /files/documents/123 HTTP/1.1 Accept: application/vnd.huddle.data+json Authorization: OAuth2 frootymcnooty/vonbootycherooty
HTTP/1.1 200 OK Content-Type: application/vnd.huddle.data+json
{ ... "links": [ { "rel": "difference-previous-version", "href": "/files/documents/123/versions/1000/difference/previous" }, ... ], ... [other document elements] }
If you issue a GET at the "difference-previous-version" link, and receive a 404, then the difference has not yet been created. In order to create it, issue a POST at the link.
POST /files/documents/123/versions/1000/difference/previous HTTP/1.1 Authorization: OAuth2 frootymcnooty/vonbootycherooty
HTTP/1.1 202 Accepted
The difference will now be generating. In order to track progress poll the resource until you receive a 200. The best practice is to poll this resource for 30 seconds and then assume that the difference has not been created and give up.
If the difference exists, you will be returned a response detailing the difference assets. Note that self link has been translated from
/files/documents/123/versions/1000/difference/previous to the more terse alias uri /files/documents/123/versions/900/difference/1000
Where version 900 is the previous version of 1000.
GET /files/documents/123/versions/1000/difference/previous HTTP/1.1 Accept: application/vnd.huddle.data+json Authorization: OAuth2 frootymcnooty/vonbootycherooty
HTTP/1.1 200 Accepted Content-Type: application/vnd.huddle.data+jon { "links": [ { "rel": "self", "href": "/files/documents/123/versions/900/difference/1000" }, { "rel": "contents", "href": "/files/documents/123/versions/7303/difference/1000/content/difference.pdf" }, { "rel": "summary", "href": "/files/documents/123/versions/7303/difference/1000/content/difference.json" } ] }
The contents link gives a visual representation of the difference. The summary link gives statistics about the difference.
You can create a difference between a version and another version within a document. The Difference API can return a PDF representation of both versions, with differences highlights AND can return a statistical summary of those difference.
The difference link is instructing you to refer to the json-home endpoint to look up how to construct a difference link. See API "Home Document"
GET /files/documents/123 HTTP/1.1 Accept: application/vnd.huddle.data+json Authorization: OAuth2 frootymcnooty/vonbootycherooty
HTTP/1.1 200 OK Content-Type: application/vnd.huddle.data+xml
{ ... "links": [ { "rel": "http://api.huddle.{TLD}/rel/files/difference", "href": "http://api.huddle.{TLD}", "type": "application/json-home" }, ... ], ... [other document elements] }
GET http://api.huddle.{TLD} Content-Type: application/json-home
HTTP/1.1 200 OK Content-Type: application/json-home { "resources": { ... "http://api.huddle.net/rel/files/difference": { "href-template": "/files/documents/{document-id}/versions/{source-document-version-id}/difference/{compared-to-document-version-id}", "href-vars": { "document-id": "http://api.huddle.{TLD}/param/document-id", "source-document-version-id": "http://api.huddle.{TLD}/param/document-version-id", "compared-to-document-version-id": "http://api.huddle.{TLD}/param/document-version-id" }, "hints": { "allow": ["GET", "POST"] } } ... } }
Now you can look up "http://api.huddle.{TLD}/rel/files/difference" from the response body to find out how to construct the link.
e.g. /files/documents/123/versions/900/difference/1000
If you issue a GET at the client constructed "difference" link, and receive a 404, then the difference has not yet been created. In order to create it, issue a POST at the link.
POST /files/documents/123/versions/900/difference/1000 HTTP/1.1 Authorization: OAuth2 frootymcnooty/vonbootycherooty
HTTP/1.1 202 Accepted
The difference will now be generating. In order to track progress poll the difference resource until you receive a 200. The best practice is to poll this resource for 30 seconds and then assume that the difference has not been created and give up.
If the difference exists, you will be returned a response detailing the difference assets.
GET /files/documents/123/versions/900/difference/1000 HTTP/1.1 Accept: application/vnd.huddle.data+json Authorization: OAuth2 frootymcnooty/vonbootycherooty
HTTP/1.1 200 Accepted Content-Type: application/vnd.huddle.data+jon { "links": [ { "rel": "self", "href": "/files/documents/123/versions/900/difference/1000" }, { "rel": "contents", "href": "/files/documents/123/versions/7303/difference/1000/content/difference.pdf" }, { "rel": "summary", "href": "/files/documents/123/versions/7303/difference/1000/content/difference.json" } ] }
The contents link gives a visual representation of the difference. The summary link gives statistics about the difference.
- Basic concepts
-
Resources
- Actor
- Approvals
- BulkProcess
- Calendar
- Membership
- Company
- Document
- Document library settings
- Folder
- Paged Folder
- Pins
- Integrations
- Form
- Friends
- Invitation
- Link
- Document Lock
- Folder Lock
- Localisation
- MemberAutocomplete
- Notifications
- Offline item
- PeopleBulkProcess
- Permissions
- Presence
- PublishedDocuments
- Recents
- Recommendations
- Recycle Bin
- Search
- Share
- Tasks (Todos), File Requests, Approvals
- Tasks on Documents
- Actions
- UserApprovals
- User
- VersionHistory
- Workspace
- Workspaces
- SamlPartners
- Logout
- Impersonation
- Administration
- WebHooks