ConversionQA Command Line REST Client
This sample command line application can be used to experiment with the ConversionQA REST server. Please note that the REST server must be running for this code to operate. This client connects to http://localhost:8080
by default, but you can use the property host
to customise the host, e.g. -Dhost=http://localhost:1234
to point to the REST service running on a different port to the default of 8080.
This command-line driver was written to demonstrate the use of the ConversionQA REST API, and is not intended as a primary way of interacting with it. Please customise the source code as needed. Currently, it uses asynchronous calls with multipart/form-data
. This sample processes responses as Strings and uses XPath to get information from the responses.
Start the REST Server
Before running the command-line client, the ConversionQA REST server must be started by running the deltaxml-conversion-qa-x.y.z.jar
and specifying the start-rest-server
command.
List the Available Commands
Run the jar without any arguments to list the available commands.
java -jar deltaxml-conversion-qa-rest-client-x.y.z.jar
DeltaXML ConversionQA X.Y.Z
Released 2023-10-09
Copyright (c) 2023 Deltaman Group Ltd. All rights reserved.
Usage:
java -jar javarestcli.jar describe <inputType> to see a description of the required input format for the specified check type
java -jar javarestcli.jar check <input-A-type> <input-A-arguments> <input-B-type> <input-B-arguments> [output=value] [ignoreelementsxpaths="value"]
Available Input Types:
====================================================
Input Type | Short Description
====================================================
ditamap | A DITA document passed as a zip file, which must contain a master map file with '.ditamap' extension
docx | A Microsoft Word document file with extension '.docx'
xml | A non-specific XML format file
====================================================
There is also a describe command to get more detail on the available commands.
java -jar deltaxml-conversion-qa-rest-client-x.y.z.jar describe
DeltaXML ConversionQA X.Y.Z
Released 2023-10-09
Copyright (c) 2023 Deltaman Group Ltd. All rights reserved.
The 'describe' command lists the parameters available for a specific input type
when 'describe' is followed by one of these input types:
'ditamap' - A DITA document passed as a zip file
'docx' - A Microsoft Word document file
'xml' - A non-specific XML format file
You can also add one of these optional 'key=value' parameters to any 'check' command:
'output' - A path to a file to write the output to
'ignoreelementsxpaths' - A string of xpath values that you want to ignore
Example
Here is an example run to check two inputs named doc.docx, and doc.zip.
java -jar deltaxml-conversion-qa-rest-client-1.0.0.jar check docx -f doc.docx ditamap -f doc.zip -m output/doc.ditamap
DeltaXML ConversionQA X.Y.Z
Released 2023-10-09
Copyright (c) 2023 Deltaman Group Ltd. All rights reserved.
Job running: http://0.0.0.0:8080/api/conversionqa/v1/jobs/9352fc0b-cb91-472b-ae90-f1f002a35f89
Progress:
QUEUED
SUBMITTED
STARTED
INPUTS_LOADING_A
INPUTS_LOADING_B
INPUT_FILTERS
CHECK_RUNNING
OUTPUT_FILTERS
SAVING
FINISHED
Result written to ./output.html