Specifying Comparisons
To invoke a comparison, you POST parameters to the specified pipeline, in either JSON or XML form.
Synchronous Comparison
Here is a simple synchronous example (see Asynchronous Comparison for asynchronous comparisons):
Request (XML)
<compare>
<inputA type="file">
<path>samples/compare/xml/AnimalsOrig.xml</path>
</inputA>
<inputB type="file">
<path>samples/compare/xml/Animals2.xml</path>
</inputB>
<configurationParameters>
<configurationParameter type="boolean">
<name>Preserve Whitespace</name>
<value>false</value>
</configurationParameter>
<configurationParameter type="boolean">
<name>Word By Word</name>
<value>true</value>
</configurationParameter>
<configurationParameter type="string">
<name>Indent</name>
<value>yes</value>
</configurationParameter>
</configurationParameters>
</compare>
Request (JSON)
{
"inputA": {
"type": "file",
"path": "samples/compare/xml/AnimalOrig.xml"
},
"inputB": {
"type": "file",
"path": "samples/compare/xml/Animals2.xml"
},
"configurationParameters": [
{
"name": "Word By Word",
"value": true,
"type": "boolean"
},
{
"name": "Indent",
"value": "yes",
"type": "string"
}
]
}
The request above shows how comparison inputs could be specified using a HTTP URL. The inputA and inputB elements in the request can contain different types of children according to the types of data being processed. This is described in more detail at I/O Types.
The request allows the pipeline parameters to be changed from their default values.
Response
HTTP/1.1 201 Created
<root xmlns:deltaxml="http://deltaxml.com/ns/well-formed-delta-v1" deltaxml:deltaV2="A!=B">
<child deltaxml:deltaV2="A=B">...</child>
<child deltaxml:deltaV2="A!=B">...</child>
</root>
The response indicates the comparison result, in this case an XML Delta describing the changes between the inputs specified in the request. The ellipses would show the actual content.
Form Input
In addition to requests in structured XML or JSON format, multipart/form-data can also be used.
For example:
Request
POST /api/xml-compare/v1/pipelines/delta HTTP/1.1
Content-Type: multipart/form-data; boundary=boundary-id
Content-Length: number_of_bytes_in_entire_request_body
--boundary-id
Content-Disposition: file; filename="file1.xml"
Content-Size: 98344
Content-Type: application/xml
... XML ...
--boundary-id
Content-Disposition: file; filename="file2.xml"
Content-Size: 92224
Content-Type: application/xml
... XML ...
--boundary-id
Content-Disposition: form-data; name="Word By Word"
true
--boundary-id
Content-Disposition: form-data; name="Indent"
yes
--boundary-id
Content-Disposition: form-data; name="async"
true
--boundary-id
Configuration Parameters are specified by using the name of the pipeline parameter as the name of the form data element.
For example, the example above sets two parameters - "Word By Word" and "Indent". Note each parameter is specified separately.
Related Topics
See the following topics for more specific detail on running comparisons for different capabilities: