This API is used to export the existing batch class. This method will take the batch class identifier and learnt-sample to be exported with the batch class.
Request Method POST
Web Service URL: http://{serverName}:{port}/dcma/rest/exportBatchClass
Input Parameter | Values | Descriptions |
identifier | This value should not be empty and valid batch class identifier. | This parameter is used for identifying which batch class is to be exported. |
lucene-search-classification-sample | Either “true”/”false” | This parameter is used to decide if the lucene learnt sample is exported with batch class or not. |
image-classification-sample | Either “true”/”false” | This parameter is used to decide if the image classification sample is exported with batch class or not. |
CheckList:-
- Identifier should be a valid batch class identifier.
Sample client code using apache commons http client:-
private static void exportBatchClass() { HttpClient client = new HttpClient(); String url = "http://localhost:8080/dcma/rest/exportBatchClass"; PostMethod mPost = new PostMethod(url); String batchClassIdentifier = "BC4"; mPost.addParameter("identifier", batchClassIdentifier); mPost.addParameter("lucene-search-classification-sample", "true"); mPost.addParameter("image-classification-sample", "false"); int statusCode; try { statusCode = client.executeMethod(mPost); if (statusCode == 200) { System.out.println("Batch class exported successfully"); InputStream in = mPost.getResponseBodyAsStream(); File f = new File("C:\\sample\\serverOutput.zip"); FileOutputStream fos = new FileOutputStream(f); try { byte[] buf = new byte[1024]; int len = in.read(buf); while (len > 0) { fos.write(buf, 0, len); len = in.read(buf); } } finally { if (fos != null) { fos.close(); } } } else if (statusCode == 403) { System.out.println("Invalid username/password."); } else { System.out.println(mPost.getResponseBodyAsString()); } } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (mPost != null) { mPost.releaseConnection(); } } }