This API will create the new document type for the specified batch class supplied as an input.

Request Method POST

Web Service URL:

http://{serverName}:{port}/dcma/rest/batchClass/documentTypeCreator

Input Parameters:

Input Parameter Values Descriptions
documentTypeName The document type name should be nonempty and should not contain ‘*’ symbol. This parameter is the unique name of the new  document type to be create
documentTypeDescription This should be a non-empty Value This parameter is the description of the new document type created
minConfidenceThreshold The minimum confidence threshold cannot be null and should be between 0 and 100 inclusive of both. The minimum threshold value for the documents recognition
formProcessingProjectFile The name of the RSP file for recostar extraction This file would be used for KV extraction by Recostar engine
batchClassIdentifier This value should be nonempty and a pre-existing Batch Class Identifier The identity of the Batch Class Identifier under which document type is to be created
Hidden Can be true or false This parameter signifies whether new document type created should be hidden or not.

 

Check List:-

  1. documentTypeName should be unique and non-empty.
  2. minConfidenceThreshold should be a value between 0 and 100.
  3. formProcessingProjectFile should be a name of pre-existing RSP/ZON file.
  4. batchClassIdentifier should be an identity of pre-existing Batch Class.

Sample Input XML:

<?xml version="1.0" encoding="UTF-8"?>

<WebServiceParams>

 

<Params>

 

<Param>

 

<Name>documentTypeName</Name>

 

<Value>MyDocument</Value>

 

</Param>

 

<Param>

 

<Name>documentTypeDescription</Name>

 

<Value>Abcd</Value>

 

</Param>

 

<Param>

 

<Name>minConfidenceThreshold</Name>

 

<Value>100</Value>

 

</Param>

 

<Param>

 

<Name>firstPageProjectFile</Name>

 

<Value>FPR.rsp</Value>

 

</Param>

 

<Param>

 

<Name>batchClassIdentifier</Name>

 

<Value>BC4</Value>

 

</Param>

 

<Param>

 

<Name>hidden</Name>

 

<Value>FALSE</Value>

 

</Param>

 

</Params>

 

</WebServiceParams>

 

Note: Values highlighted in blue should be replaced with corresponding values while executing the Web service for copying an existing batch Class.

 

Sample client code using apache commons http client:-

private static void createDocumentType() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/batchClass/documentTypeCreator";
		PostMethod mPost = new PostMethod(url);
		// Adding Input XML file for processing
		File file = new File("C:\\sample\\sample.xml");
		Part[] parts = new Part[1];
		try {
			parts[0] = new FilePart(file.getName(), file);
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = mPost.getResponseBodyAsString();
				// Generating result as responseBody.
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

Was this article helpful to you?

Engineering

Comments are closed.