This API is used to classify the input barcode image according to the specified batch class. Image file should have barcode and barcode value should be document type which is present in the batch class.
Request Method POST
Input Parameters
Input Parameter | Values | Descriptions |
batchClassId | This value should not be empty and it should be batch class identifier like BC1. | This parameter is used for providing batch class identifier on which classify HOCR will perform. |
Web Service URL: http://{serverName}:{port}/dcma/rest/classifyBarcodeImage
Checklist:
- Input file should be single page tif/tiff file only.
- batchClassId should be valid batch class identifier and must have the “BARCODE_READER” plugin configured .
Sample client code using apache commons http client:-
private static void classifyBarcodeImage() { HttpClient client = new HttpClient(); String url = "http://localhost:8080/dcma/rest/classifyBarcodeImage"; PostMethod mPost = new PostMethod(url); // Adding image file for processing the barcode classification File file1 = new File("C:\\sample\\US-Invoice.tif"); Part[] parts = new Part[2]; try { parts[0] = new FilePart(file1.getName(), file1); // Adding batchClassId for which barcode classification to be perform. String batchClassId = "BC5"; parts[1] = new StringPart("batchClassId", batchClassId); 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(); 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(); } } }