Requests

A merge operation is performed by invoking an HTTP POST method with inputs and parameters for a specified merge type. The HTTP POST requests can be made in three different ways:

  • A multipart/form-data request (this is required if you need to upload files from the client)
  • A single XML request
  • A single JSON request

There are two types of connection that can be made using the POST request, a Synchronous connection, or an Asynchronous connection.

Synchronous

Here is a simple synchronous example using Concurrent Merge. In this example there are three versions specified. The versions will be added to the merger in the order specified. There are also various parameters set.  These include settings for indentation and result type.  See the page  Specifying Parameters for details of the parameters.

multipart/form-data Requests

This type of request allows file-objects to be uploaded to a remote REST server. Note that you can also use the XML/JSON requests to specify HTTP URIs, see I/O Types.

Examples of multipart/form-data requests are available on the Postman documentation. The following links provide examples of multipart/form-data requests for each merge type:

XML Request Example

Request
<ConcurrentMerge>
  <Versions>
    <Version type="file" name="anna">
      <Path>/usr/local/deltaxml/DeltaXML-DITA-Merge-x_y_z_j/samples/data/four-edits.xml</Path>
    </Version>
    <Version type="file" name="ben">
      <Path>/usr/local/deltaxml/DeltaXML-DITA-Merge-x_y_z_j/samples/data/four-edits-ben.xml</Path>
    </Version>
    <Version type="file" name="chris">
      <Path>/usr/local/deltaxml/DeltaXML-DITA-Merge-x_y_z_j/samples/data/four-edits-chris.xml</Path>
    </Version>
  </Versions>
  <Configuration>
    <Indent>true</Indent>
  </Configuration>
  <ResultType>RULE_PROCESSED_DELTAV2</ResultType>
</ConcurrentMerge>

JSON Request Example

Request
{
  "Versions": [
    {
      "type": "file",
      "name": "anna",
      "Path": "/usr/local/deltaxml/DeltaXML-DITA-Merge-3_0_0_j/samples/data/four-edits-anna.xml"
    },
    {
      "type": "file",
      "name": "ben",
      "Path": "/usr/local/deltaxml/DeltaXML-DITA-Merge-3_0_0_j/samples/data/four-edits-ben.xml"
    },
    {
      "type": "file",
      "name": "chris",
      "Path": "/usr/local/deltaxml/DeltaXML-DITA-Merge-3_0_0_j/samples/data/four-edits-chris.xml"
    }
  ],
  "Configuration": {
    "Indent": true
  },
  "ResultType": "RULE_PROCESSED_DELTAV2"
}

XML Result

Response Excerpt
<topic 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" 
  id="topic_xxs_klq_fh" 
  deltaxml:deltaV2="anna!=ben!=chris">
  <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 DITA Merge</title>
  <body deltaxml:deltaV2="anna!=ben!=chris">
    ....
   </body>
</topic>


#content .code