Running rules directly on images by using Datacap Web Services transactional endpoints

The transactional endpoints can be used when you want to invoke a Datacap Web Services service by making REST calls. You provide input files such as images and execute a set of functions with rules that does image processing , OCR, redaction, and so on.

About this task

You can run the images through whatever function Datacap rules can provide without needing to go through a workflow or series of tasks, and without using Datacap Server to queue and run the tasks.

Two potential use cases for transactional endpoints include:
  • Extracting data from documents by uploading a new page file for the transaction, performing recognition and data extraction, getting the data file back, and parsing it for field values.
  • Validating data by uploading a new page file for the transaction, uploading one or more data files with field values, running the validation rules, getting the updated page and data files back, and parsing the data file for problem fields and messages.

Example

The following table displays a simplified set of client requests and the return values. This sequence runs an OCR ruleset on the provided image:
Table 1. HTTP requests and returns while running an OCR ruleset on an image
HTTP URL Request Body Result Return
POST /Session/Logon Application, Password, Station, User 200 Sets cookie
GET /Transaction/Start The request for this method contains no content. 201 transactionId
POST /Transaction/SetFile/VScan/xml multipart/form-data content 201 The response for this method contains no content.
POST /Transaction/SetFile/tm000001/tif multipart/form-data content 201 The response for this method contains no content.
POST /Transaction/Execute Transaction ID, Application, Workflow, PageFile, Rulesets 200 Result set
GET /Transaction/GetFile/transactionId/_rrs/log The request for this method contains no content. 200 File contents byte stream
GET /Transaction/GetFile/transactionId/tm000001/xml The request for this method contains no content. 200 File contents byte stream
POST /Session/Logoff The request content includes the wTmId cookie the request header. 200 The response for this method contains no content.

In this example, VScan.xml file must be constructed in advance to point to the image, and the parameters that are passed to Transaction/Execute in the request body consist of the transactionId, application, workflow, PageFile, and any rulesets.

In JSON, the Transaction/Execute request body would be similar to the following:
{
"TransactionId":"2fde5e64-d3ca-4798-824a-feaf880d2099", 
"Application":"MyApp", 
"Workflow":"OCR",
"PageFile":"VScan.xml", 
"Rulesets":"Batch Profiler"
}