Adapting the sample project for use with the ABBYY FlexiCapture Cloud REST API

REST API workflow

The typical REST API workflow is as follows:

Any FlexiCapture project to be used with your REST API application must include a properly configured workflow. Below, you will find step-by-step instructions on how to adapt the workflow of the sample Banking Card Application project for use with the REST API (for more information about the sample projects, see the ABBYY FlexiCapture sample projects section).

Before proceeding with this walkthrough, please launch the Project Setup Station and open the sample Banking Card Application project (the default location is C:\Users\Public\ABBYY\FlexiCapture\12.0\Samples\FlexiCapture\English\Banking_eng\banking_eng.fcproj).

Adjusting workflow stages

Note: The REST API always submits data to be processed as the "Default" batch type. For this reason, all document processing in the project must be configured for the "Default" batch type.

  1. On the Project menu, click Project Properties and then click the Workflow tab. From the Schema drop-down list, select Advanced and modify the workflow settings as shown below:

  1. Click VerificationGeneral and select the Enable web stations option.
    Note: You can omit this setting if you don’t need a verification stage in your project.
  2. Click Verification → Entry Conditions and set the Documents are admitted to stage option to Always.
    Note: Depending on the requirements of your solution, you may want to disable the verification stage temporarily or conditionally using a script-based rule on the Entry Conditions tab.

  1. To enable the training/layout/{taskId}/{fileId} endpoint for your project, you need to export the XML file containing the field data and layout. To do this:
    1. Create a document processing stage immediately preceding the verification stage:
         
    2. On the Entry Conditions tab, choose Always.
    3. On the Script tab, click the Edit script… button.
      :
    4. Change the script language to C# .Net:
    5. Copy and paste the following code snippet into the script pane:
using System;
Document.SaveXmlToFileStorage();
        
  1. Click OK to save your changes.

Adjusting data export settings

Once a batch submitted through the REST API is processed, the REST API will pick up any exported files to make them available for download by the client.

Important! ABBYY FlexiCapture Cloud stores exported files in object storage. For this reason, you must not use rooted export paths in your REST API project.

REST API projects do not require any special folder structure. You can use a flat folder structure, using the name of the root folder for each batch, and document IDs as parts of file names. The REST API services will assign a unique and random batch name to each batch submitted via the REST API. That way, unique file names will be generated when exporting data from batches submitted via the REST API.

The following screenshot shows the original export settings that result in a multi-level folder structure:

 

The following screenshot shows the modified export settings that results in a flat folder structure:

Uploading your modified project to ABBYY FlexiCapture Cloud

  1. Click File > Upload Project to Server... to upload your project to ABBYY FlexiCapture Cloud.
  2. In the dialog box that opens, enter the URL of the cloud server hosting your tenant and specify the name of your tenant.
  3. Select Use server authentication and enter your tenant admin credentials.
  4. Click Test connection to check your connection settings.
  5. Click OK and wait until your project is uploaded.

9/15/2020 9:42:43 AM


Please leave your feedback about this article