Merge Requests
The Merge REST API accepts merge requests via HTTP POST.
XML Merge Request
POST /api/merge/xml/types/concurrent
Content-Type: application/json
DITA Merge Request
POST /api/merge/dita/types/concurrent
Content-Type: application/json
The type of merge must be specified as part of the request as seen above. And the types of merge can be seen below
Merge Types
|
mergeType |
Description |
|---|---|
|
|
N-way concurrent merge (ancestor + multiple edits) |
|
|
Three-way concurrent merge with simplified output options |
|
|
N-way sequential merge (ordered chain of versions) |
Request (XML format)
<concurrentMerge>
<versions>
<version type="file" name="anna">
<path>samples/merge/xml/four-edits-anna.html</path>
</version>
<version type="file" name="ben">
<path>samples/merge/xml/four-edits-ben.html</path>
</version>
<version type="file" name="chris">
<path>samples/merge/xml/four-edits-chris.html</path>
</version>
</versions>
<configuration type="file">
<path>samples/merge/xml/concurrent-merge-sample-configuration.xml</path>
</configuration>
</concurrentMerge>
Request (JSON format)
{
"ancestor": {
"type": "file",
"name": "anna",
"path": "samples/merge/xml/four-edits-anna.html"
},
"versionOne": {
"type": "file",
"name": "ben",
"path": "samples/merge/xml/four-edits-ben.html"
},
"versionTwo": {
"type": "file",
"name": "chris",
"path": "samples/merge/xml/four-edits-chris.html"
},
"configuration": {
"type": "file",
"path": "samples/merge/xml/concurrent-merge-sample-configuration.xml"
}
}
The synchronous response returns the merge result directly:
Response
HTTP/1.1 200 OK
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:deltaxml="http://www.deltaxml.com/ns/well-formed-delta-v1"
deltaxml:version-order="anna, ben, chris"
deltaxml:content-type="merge-concurrent"
deltaxml:version="2.0"
deltaxml:deltaV2="anna!=ben!=chris">
<head deltaxml:deltaV2="anna=chris!=ben">
<title deltaxml:deltaV2="anna=chris!=ben">
<deltaxml:textGroup deltaxml:deltaV2="ben" deltaxml:edit-type="add">
<deltaxml:text deltaxml:deltaV2="ben">An </deltaxml:text>
</deltaxml:textGroup>Example for DeltaXML Merge
</title>
</head>
<body deltaxml:deltaV2="anna!=ben!=chris">
...
</body
</html>
multipart/form-data Alternative
Files can also be uploaded directly:
POST /api/merge/xml/types/concurrent
Content-Type: multipart/form-data; boundary=boundary-id
--boundary-id
Content-Disposition: form-data; name="versionOrder"
anna,ben,chris
--boundary-id
Content-Disposition: form-data; name="ancestor"; filename="ancestor.xml"
Content-Type: application/xml
--boundary-id
Content-Disposition: form-data; name="ben"; filename="anna.xml"
Content-Type: application/xml
--boundary-id
Content-Disposition: form-data; name="chris"; filename="ben.xml"
Content-Type: application/xml
--boundary-id
Content-Disposition: file; filename="concurrent-merge-sample-configuration.xml"
Content-Type: application/xml
The following table describes the parts that can make up the form-data:
|
Parameter |
Description and example usage |
|---|---|
|
inputs (required) |
N number of inputs for concurrent and sequential Merge, and 3 inputs for threeway merge. Can be specified in either a file path, a HTTP URI, or raw XML |
|
configuration |
Configuration file See this page for more information on configuration files. Can be specified in either a file path, a HTTP URI, or raw XML |
|
async |
Whether async comparison is used. Default value if not specified: false |
|
output |
An optional file path to write the output to when using async. E.g. "/Users/exampleUser/Documents/test.xml" |
|
callback |
Callback URL called after comparison is complete. Note : only used with asynchronous comparisons. See this page. |