Skip to main content

REST API workflow

The typical REST API workflow is as follows:
Diagram of the typical FlexiCapture Cloud REST API workflow, showing the steps from uploading files and creating a task through polling status, getting results for verification, optional custom verification and training, and removing input and output files.
Any FlexiCapture project to be used with your REST API application must include a properly configured workflow. The instructions below show 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 ABBYY FlexiCapture sample projects. Before proceeding with this walkthrough, 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).

Adjust workflow stages

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

Select the Advanced workflow schema

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.
Screenshot of the Workflow tab in the Project Properties dialog box of the ABBYY FlexiCapture Project Setup Station, showing the Advanced schema selected with its workflow stages.
2

Enable web stations for verification

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.
3

Set the verification entry condition

Click VerificationEntry Conditions and set the Documents are admitted to stage option to Always.
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.
Screenshot of the Entry Conditions tab of a verification stage in the ABBYY FlexiCapture Project Setup Station, showing the Documents are admitted to stage option set to Always.
4

Add a stage to export the XML layout

To enable the training/layout/{taskId}/{fileId} endpoint for your project, export the XML file containing the field data and layout. Create a document processing stage immediately preceding the verification stage.
Screenshot of the workflow stages in the ABBYY FlexiCapture Project Setup Station, with a new document processing stage added immediately before the verification stage.
5

Set the new stage's entry condition

On the Entry Conditions tab, choose Always.
Screenshot of the Entry Conditions tab of the new processing stage in the ABBYY FlexiCapture Project Setup Station, with the admission condition set to Always.
6

Open the script editor

On the Script tab, click Edit script….
Screenshot of the Script tab of a processing stage in the ABBYY FlexiCapture Project Setup Station, with the Edit script button.
7

Set the script language

Change the script language to C# .NET.
Screenshot of the script editor in the ABBYY FlexiCapture Project Setup Station, with the script language set to C# .NET.
8

Add the export script

Copy and paste the following code snippet into the script pane:
9

Save your changes

Click OK to save your changes.
The project settings on document assembly (Image processing → Create document) are ignored when uploading files via the REST API. A separate document is created for each file.

Adjust data export settings

Once a batch submitted through the REST API is processed, the REST API picks up any exported files to make them available for download by the client.
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 assign a unique, random batch name to each batch submitted via the REST API, so unique file names are generated when exporting data from those batches. The following screenshot shows the original export settings, which result in a multi-level folder structure:
Screenshot of the export settings in the ABBYY FlexiCapture Project Setup Station, showing the original file naming that produces a multi-level folder structure.
The following screenshot shows the modified export settings, which result in a flat folder structure:
Screenshot of the export settings in the ABBYY FlexiCapture Project Setup Station, showing the modified file naming that produces a flat folder structure.

Upload your modified project to ABBYY FlexiCapture Cloud

1

Open the upload dialog

Click File > Upload Project to Server… to upload your project to ABBYY FlexiCapture Cloud.
2

Enter the server and tenant

In the dialog box that opens, enter the URL of the cloud server hosting your tenant and specify the name of your tenant.
3

Enter your credentials

Select Use server authentication and enter your tenant admin credentials.
4

Test the connection

Click Test connection to check your connection settings.
5

Upload the project

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: