メインコンテンツへスキップ
REST API には、レポートデータを取得するためのメソッドが用意されています。 各 request では、ABBYY FlexiCapture application server への request で取得した Bearer トークンを使用して、毎回認証を行う必要があることに注意してください。このテナントのデータにアクセスできるのは、そのテナントの Administrator または Monitoring Operator のみです。 ABBYY FlexiCapture Reporting service data access がインストールされている任意のマシンでは、http://localhost:8002 で API の説明を参照することもできます。 以下は、ABBYY FlexiCapture アカウントで認証し、指定したテナントと期間のレポート統計アーカイブをダウンロードする方法を示すコード例です。
# 指定したテナントのレポート統計を含むアーカイブをダウンロードします
function GetDataFile {
Param (
[Parameter(Mandatory=$true)][String]$AppServer,
[Parameter(Mandatory=$true)][AllowEmptyString()][string]$TenantName,
[Parameter(Mandatory=$true)][string]$User,
[Parameter(Mandatory=$true)][string]$Password,
[Parameter(Mandatory=$true)][Int]$Year,
[Parameter(Mandatory=$true)][Int]$Month,
[Parameter(Mandatory=$true)][string]$DownloadPath,
[Parameter(Mandatory=$true)][string]$ReportingServiseUri
)
# 関数の Parameter で渡されたテナント名と application server アドレスを使用します
$URI = "https://$AppServer/Flexicapture12/Server/FCAuth/API/wsdl?Tenant=$TenantName"
# 指定された Username と password で PSCredential object を作成します
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList @($user,(ConvertTo-SecureString -String $password -AsPlainText -Force))
# これらの credentials で認証するプロキシ Web service を作成します
$proxy = New-WebServiceProxy -Uri $URI -Credential $creds
$proxy.Url = "https://$AppServer/flexicapture12/Server/FCAuth/API/Soap?Tenant=$TenantName"
$proxy.Credentials = $creds
# これを使用して FlexiCapture API にトークンを要求します
$ticket = $proxy.GetCurrentUserAuthTicket()
$nameFile = $year.ToString() + "-" + $month.ToString()
# ダウンロードファイルの path を作成します
$path = "$DownloadPath\$nameFile.zip"
# トークンを含む Bearer authentication header を付けた request を作成し、
# Reporting data access service に送信して、指定したテナントと期間のアーカイブを取得します
$headers = @{ Authorization = "Bearer " + $ticket}
Invoke-RestMethod -Uri $ReportingServiseUri"?tenantName=$TenantName&year=$year&month=$month" -Headers $headers -OutFile $path
}
GetDataFile