Getting data using the API

Path to the Business Process Reporting data storage

Entry points:

/Reporting/BatchState/List
/Reporting/BatchState/File/<filename>
/Reporting/BatchState/View
/Reporting/BatchRouting/List
/Reporting/BatchRouting/File/<filename>
/Reporting/BatchRouting/View

The full path to the data storage is a link that can be modified.

Example:

http://localhost/Flexicapture12/Server/Reporting/BatchState/View

For access via the ABBYY FlexiCapture authentication module, the following is added to the link: /FCAuth

Authorized access is allowed in the following cases:

    • For authorized ABBYY FlexiCapture users.
    • When using SAML/JWT tokens.

Example:

http://localhost/Flexicapture12/Server/FCAuth/Reporting/BatchState/View

If the tenant is not the default one, the following parameter is added to the link: ?Tenant=<tenant name>.

Example:

http://localhost/Flexicapture12/Server/FCAuth/Reporting/BatchState/View?Tenant=myTenant

Creating requests

Only GET requests are accepted.

List returns a list of filenames in JSON format.

File returns a file with the specified name (which should be encoded in URL format).

View returns a list of filenames in HTML format and inserts links to the files using the File command described above. As such, this request allows you to use the provided links to open files in your browser and save copies of them to your local machine.

Examples:

http://localhost/Flexicapture12/Server/FCAuth/Reporting/BatchState/View
http://localhost/Flexicapture12/Server/FCAuth/Reporting/BatchRouting/View

Getting Business Process Reporting reports using PowerShell scripts

The script below lets tenant users with Administrator or Monitoring Operator roles get business process monitoring data.

Reports are saved in CSV format to the folder where the script was launched from.  

$serviceHost = 'http://localhost' #Host
$user=$null #User
$pass=$null #Password
$tenant=$null #Tenant name

$baseUrl = $serviceHost
if( $user ) {
   $baseUrl += '/flexicapture12/server/FCAuth/Reporting/'
   } else {    $baseUrl += '/flexicapture12/server/Reporting/'
   }function createBasicCredentials() #Transforms password to encrypted strings
{
   $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
   return New-Object System.Management.Automation.PSCredential($user, $secpasswd)
}

function getListFromUrl( $url ) #Authenticates using entered credentials
{
   if( $tenant ) {
       $url = $url + '?Tenant=' + [uri]::EscapeUriString( $tenant );
   }
   if( $user ) {
       $creds = createBasicCredentials -user $user -pass $pass
       $response = Invoke-WebRequest -Credential $creds -Uri $url;
   } else {
       $response = Invoke-WebRequest -UseDefaultCredentials -Uri $url;
   }
   $fileList = $response.ToString() | ConvertFrom-Json;
   return $fileList.reportFiles;
}

function getBatchStateFileList() #Requests a list of BatchState files
{
   $url = $baseUrl + 'BatchState/List';
   return getListFromUrl -url $url
}

function getBatchRoutingFileList() #Requests a list of BatchRouting files
{
   $url = $baseUrl + 'BatchRouting/List';
   return getListFromUrl -url $url
}

function downloadFile ( $fileName, $outDir ) #Downloads files  
{
   $url = $baseUrl + 'BatchState/File/' + [uri]::EscapeUriString( $fileName );
   if( $tenant ) {
       $url = $url + '?Tenant=' + [uri]::EscapeUriString( $tenant );
   }
   $outPath = Join-Path -Path $outDir -ChildPath $fileName
   if( $user ) {

       $creds = createBasicCredentials -user $user -pass $pass
       $response = Invoke-WebRequest -Credential $creds -Uri $url;
       $response = Invoke-WebRequest -Credential $creds -Uri $url -OutFile $outPath

   } else {
       $response = Invoke-WebRequest -UseDefaultCredentials -Uri $url -OutFile $outPath
   }
}

$files = getBatchStateFileList; #Uploads BatchState files to the current directory
foreach ($file in $files) {  
   downloadFile -fileName $file -outDir '.\'
}

$files = getBatchRoutingFileList; #Uploads BatchRouting files to the current directory
foreach ($file in $files) {  
   downloadFile -fileName $file -outDir '.\'
}

12.04.2024 18:16:02

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.