Workflows controller

GET /api/workflows

Gets a list of all the available workflows, together with their statuses and settings.

  • GET /api/workflows  /* get the workflow names, statuses, and settings */
  • GET /api/workflows?view=Summary  /* get the workflow names and statuses */

Sample response for the last request:

[
 {
   "Name": "DefaultWorkflow",
   "WorkflowState": "WS_Suspended"
 },
 {
   "Name": "DemoWorkflow",
   "WorkflowState": "WS_Processing"
 }
]

Counterpart SOAP methods: WebService.GetWorkflowsWebService.GetWorkflowsSettings.

GET /api/workflows/{workflowName}

Gets the status and settings of a workflow named workflowName.

  • GET /api/workflows/DemoWorkflow /* get the status and settings */
  • GET /api/workflows/DemoWorkflow?view=Summary /* get only the status */

There is no counterpart SOAP method.

GET /api/workflows/{workflowName}/ticket

Gets an empty ticket (i.e. a ticket that does no contain any input files) for a workflow named workflowName:

  • GET /api/workflows/DemoWorkflow/ticket

A ticket is an object that contains the parameters of a job as well as the input files to be processed. For more about tickets, please see POST /api/workflows/{workflowName}/input/ticket.

Counterpart SOAP method: WebService.CreateTicket.

POST /api/workflows/{workflowName}/input/file

Processes one file in a workflow named workflowName, using the default parameters.

POST /api/workflows/DemoWorkflow/input/file HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: application/json
{
   "FileName": "fileName.ext",
   "FileContents": "fileContentsAsBase64"
}

If successful, this method returns the ID of the created job as a string in the body of the response and the URL of the job as the Location header.

Sample response body:

"{9D1AA073-166F-4ECE-AA8E-2DB9E03907A6}"

Counterpart SOAP method: WebService.StartProcessFile.

POST /api/workflows/{workflowName}/input/files

Processes multiple files in a workflow named workflowName using the default parameters. The files are processed within one job.

POST /api/workflows/DemoWorkflow/input/file HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: application/json
[
   {
       "FileName": "fileName1.ext",
       "FileContents": "fileContentsAsBase64"
   },
   {
       "FileName": "fileName2.ext",
       "FileContents": "fileContentsAsBase64"
   }
]

If successful, this method returns the ID of the created job in the body of the response and the URL of the job as the Location header.

There is no counterpart SOAP method.

POST /api/workflows/{workflowName}/input/ticket

Submits a ticket for processing within a workflow named workflowName.

To use this method, you should:

  • Get an empty ticket for the workflow using the GET /api/workflows/{workflowName}/ticket method (an empty ticket is a ticket that contains the default processing parameters but no input files).
  • If required, change some of the fields in the ticket (i.e. job parameters).
  • Add to the ticket a field with input files for the job.
  • In the body of the request, pass the ticket to the POST /api/workflows/{workflowName}/input/ticket method.

To add input files to the ticket, you need to define the InputFiles property as follows:

{
 /* ... other fields in the ticket ... */
 "InputFiles": [
   {
     "FileData": {
       "FileName": "fileName1.ext",
       "FileContents": "fileContentsAsBase64"
     }
   },
   {
     "FileData": {
       "FileName": "fileName2.ext",
       "FileContents": "fileContentsAsBase64"
     }
   }
 ],
 /* ... other fields in the ticket ... */
}

Sample request:

POST /api/workflows/DemoWorkflow/input/ticket HTTP/1.1
Host: localhost
Content-Type: application/json
Accept: application/json
/* ... final ticket ... */

If successful, this method returns the ID of the created job in the body of the response and the URL of the job as the Location header.

Counterpart SOAP method: WebService.StartProcessTicket.

POST /api/workflows/{workflowName}/input/multipart

Added in FineReader Server 14 Release 1 Update 9.

If the size of an input file is too large, sending its contents as a Base64 string may not always be possible. In this case, you can pass one or several files using the multipart/form-data content type. The files are processed within one job.

Sample request:

POST /api/workflows/DemoWorkflow/input/multipart HTTP/1.1
Host: localhost
Content-Type: multipart/form-data; boundary=----FormBoundaryD8BTwSwAFvnTGFZe
Accept: application/json
------FormBoundaryD8BTwSwAFvnTGFZe
Content-Disposition: form-data; name="first.pdf"; filename="first.pdf"
Content-Type: application/pdf
*** contents of first.pdf ***
------FormBoundaryD8BTwSwAFvnTGFZe
Content-Disposition: form-data; name="second.pdf"; filename="second.pdf"
Content-Type: application/pdf
*** contents of second.pdf ***
------FormBoundaryD8BTwSwAFvnTGFZe--

If successful, this method returns the ID of the created job in the body of the response and the URL of the job as the Location header.

Additionally, if a file named ticket.json is present in the request, its contents are interpreted as a ticket. If this is the case, you have the following two options to specify input files:

  • Leave the InputFiles field in the ticket blank (i.e. pass null as its value). This will add all the files from the request  (excluding ticket.json itself) into the ticket.
  • Fill in the InputFiles field as usual and leave the InputFiles[i].FileData.FileContents fields blank (i.e. pass null as their values). In this case, the contents of these fields will be taken from those files in the request whose names are  specified in InputFiles[i].FileData.FileName.

Sample request for the first option:

POST /api/workflows/DemoWorkflow/input/multipart HTTP/1.1
Host: localhost
Content-Type: multipart/form-data; boundary=----FormBoundaryD8BTwSwAFvnTGFZe
Accept: application/json
------FormBoundaryD8BTwSwAFvnTGFZe
Content-Disposition: form-data; name="ticket.json"; filename="ticket.json"
Content-Type: application/json
{
   /* ... other fields in the ticket ... */
    "InputFiles": null,
  /* ... other fields in the ticket ... */
}
------FormBoundaryD8BTwSwAFvnTGFZe
Content-Disposition: form-data; name="first.pdf"; filename="first.pdf"
Content-Type: application/pdf
*** contents of first.pdf ***
------FormBoundaryD8BTwSwAFvnTGFZe
Content-Disposition: form-data; name="second.pdf"; filename="second.pdf"
Content-Type: application/pdf
*** contents of second.pdf ***
------FormBoundaryD8BTwSwAFvnTGFZe--

There is no counterpart SOAP method. However, this endpoint can be used together with the SOAP API. If a request contains a file named ticket.xml, its contents will be interpreted as a serialized representation of the XmlTicket SOAP object. For more information, see the code of WebApiSample in the installation package.

29.08.2023 11:55:29

Please leave your feedback about this article

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.