Comparing HTML Documents

Comparing HTML Documents

Prerequisites

  • HTML Compare REST server running.

  • Two HTML or XHTML input files, or HTTP URIs pointing to them.

POST a Comparison via REST

Send a POST request to the compare pipeline endpoint:

POST /api/compare/html HTTP/1.1
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="inputA"
/path/to/fileA.html
--boundary
Content-Disposition: form-data; name="inputB"
/path/to/fileB.html
--boundary
Content-Disposition: form-data; name="output"
/path/to/out.html
--boundary--

Input Specification Options

Inputs can be provided as:

Type

How to specify

File path (server-side)

Plain text path in the form-data part (Content-Type: text/plain)

HTTP/HTTPS URI

URL string in the form-data part

Raw HTML string

Inline content with Content-Type: text/html or application/xml

Note: the output parameter only supports file paths.

Form-Data Parameters

Parameter

Required

Description

inputA

Yes

Original (A) HTML document

inputB

Yes

Revised (B) HTML document

configuration

No

XML configuration file (defaults to built-in defaults)

output

No

File path to write the result to

callback

No

URL called when the comparison completes

Monitor the Comparison Job

Each comparison creates an asynchronous Job. Poll for status:

GET /api/jobs/{jobId}

Job states: QUEUEDSUBMITTEDSTARTEDINPUTS_LOADING_AINPUTS_LOADING_B
INPUT_FILTERSCOMPARISON_RUNNINGOUTPUT_FILTERSSAVINGFINISHED

Download the Result

When jobStatus is FINISHED, retrieve the output:

GET /api/downloads/{jobId}

The response is an XHTML redline document viewable in any browser.

Example Using curl

Bash
curl -X POST http://localhost:8080/api/compare/html \
  -F "inputA=@fileA.html;type=text/plain" \
  -F "inputB=@fileB.html;type=text/plain"