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.

Important! The project settings on document assembly (Image processing → Create document) are ignored when uploading files via REST API. A separate document will be created for each file.

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.

Your next steps

Once you have uploaded your project to ABBYY FlexiCapture Cloud, here is what you can try next:

  1. Create an application that is connected to your project. For more information on how to do this, see Creating applications using the FlexiCapture REST API interface.
  2. To test whether you have connected your application correctly, process a sample batch.
  3. Should you encounter any problems, please refer to Processing error diagnostics.

18.05.2023 9:30:10

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.