Integrating Document Processing into Existing Systems with Astera Server APIs

Astera Server APIs provide a powerful way to integrate automated workflows into existing enterprise systems, enabling businesses to streamline various data processing tasks. Users can schedule, execute and monitor data processing jobs on Astera’s Server programmatically as an alternative to using Astera’s Client application. By leveraging API-driven workflow execution, businesses can introduce automation without disrupting existing systems, ensuring a smooth transition to a more scalable and efficient system.

One critical application of this integration is document processing. Businesses often handle vast amounts of documents daily, ranging from invoices and reports to contracts and compliance forms. Manual document handling is time-consuming and prone to errors. To address these challenges, organizations can leverage Astera Server APIs to integrate automated document processing seamlessly into their existing systems while monitoring the file exchanges.

This document provides a technical guide for integrating document processing tasks into an enterprise system using Astera Server APIs. The use case focuses on calling an Astera flow from an external application, monitoring job execution, and tracking processed and failed files.

Use Case

A customer wants to automate document processing by integrating their system with Astera Server. The goal is to:

  • Trigger a report model (RM) processing flow from an external application.

  • Pass necessary parameters, such as file location, dynamically.

  • Monitor job execution status and retrieve processing results.

  • Track successfully processed files and capture details of failed jobs.

Solution Architecture

  1. Authentication: Obtain an access token via the Astera Server authentication API.

  2. Trigger Workflow Execution: Call the API endpoint to initiate the document processing workflow.

  3. Monitor Job Execution: Query job status using the returned jobID.

  4. Retrieve Processed Files: Fetch job logs to track successfully processed files.

  5. Handle Errors: Capture details of failed files for further investigation.

Integration Steps

Note: In this document, we will use Postman to demonstrate the API requests for authentication, triggering workflows, and monitoring job execution. However, in a real-world scenario, customers may integrate these API calls directly into their own applications.

We have the following Document Processing flow designed in Astera:

01 - Document Processing Dataflow

This dataflow takes the following inputs:

  • A pdf bank statement that you want to extract data from

  • An excel destination file path, where you want to save the extracted data.

When the flow is run, structured data will be extracted from the unstructured pdf, passed through some custom data quality checks, and written to an excel file.

We can execute and monitor the execution status of this flow programmatically from an external system using the following steps:

  1. Authentication

To interact with Astera Server APIs, first obtain an access token:

Request:

POST /api/account/login 
Content-Type: application/json 
{ 
  "user": "admin", 
  "password": "Admin123", 
  "rememberMe": 1 
} 

Response:

{ 
    "userId": 1, 
    "access_token": "your-access-token", 
    "expires_in": 2592000.0, 
    "userName": "admin", 
    "email": "admin@centerprise.com", 
    "name": "admin ", 
    "roles": "ROOT", 
    "platform": "Centerprise", 
    "isSuperUser": true 
} 
  1. Trigger Document Processing Flow

Once authenticated, initiate the document processing flow by sending a request with the necessary parameters in the request body.

Request:

POST /api/CommandLineProcessor 
Authorization: Bearer your-access-token 
Content-Type: application/json 
{ 
  "Parameters": [ 
    { 
      "ActionName": "Variables", 
      "ParameterName": "sourcefilepath", 
      "Value": "D:\\BankStatementExtraction\\Unprocessed\\Statement-1.pdf" 
    }, 
    { 
      "ActionName": "Variables", 
      "ParameterName": "destinationfilepath", 
      "Value": "D:\\BankStatementExtraction\\ExtractedOutput\\Dest.xls" 
    } 
  ], 
  "FilePath": "D:\\BankStatementExtraction\\BankStatementExtraction.Df" 
} 

Response:

02 - Job Execution Response
  1. Monitor Job Execution

To check the job status, use the jobID returned from the previous step.

Request:

GET /api/Job/:jobId/status 
Authorization: Bearer your-access-token 

Response:

03 - Job Status Response

If the job fails, the response will notify us.

04 - Job Status Response
  1. Handle Failures

If a job fails, such as in the above screenshot, capture the error details.

Request:

/api/Job/:jobId/Error 
Authorization: Bearer your-access-token 

Response:

05 - Job Error Response

Conclusion

By leveraging Astera Server APIs, organizations can establish a structured and automated approach to data processing, ensuring compatibility with their existing system. External applications can trigger flows, monitor execution, and track job progress efficiently. This use case serves as an example of how Astera’s functionalities, such as document processing, can be integrated into existing data-driven workflows, enabling organizations to maximize their technological investments.

Last updated

Was this helpful?