> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 検証

> WaitForAction タスク用の FlexiCapture Cloud REST API 検証 UI を開き、`iframe` で埋め込み、検証完了イベントを処理します。

十分な信頼度が得られなかった文字は、人間のオペレーターによる検証に回されます。検証オペレーターは、信頼度の低い文字を確認し、必要に応じて修正します。

<div id="verification-urls">
  ## 検証用 URL
</div>

REST API で作成されたタスクの検証は、プロジェクトで設定します。詳しい手順については、[ABBYY FlexiCapture Cloud REST API で使用するための sample プロジェクトの調整](/ja/flexi-capture/rest-api-sampleproject)を参照してください。

検証 UI は、追加のテナント認証なしで、`<iframe>` 要素を使用してサードパーティシステムに組み込むことができます。検証オペレーターを確認対象のデータへ誘導するため、一意の URL が使用されます。

<Note>
  検証 URL は、1 つのブラウザーウィンドウで 1 回しか開けません。つまり、1 つのタスクのドキュメントを同時に検証できるのは 1 人のユーザーのみです。ユーザーが検証 UI で開けるタスクの総数は、テナントのライセンス上の制限によって決まります (詳しくは、[ライセンス パラメーター](/ja/flexi-capture/license-manager/license-param)を参照してください) 。
</Note>

検証 UI は、Web Verification Station と同じ機能を提供します。

<div id="open-the-verification-ui">
  ## 検証 UI を開く
</div>

REST API タスクの検証 UI を開くには、次の手順に従います。

<Steps>
  <Step title="タスクを作成する">
    REST API を使用して、文書処理タスクを作成します。
  </Step>

  <Step title="タスクのステータスを確認する">
    タスクのステータスを確認します。検証 UI を開けるのは、ステータスが **WaitForAction** のタスクのみです。タスクのステータスの詳細については、[ABBYY FlexiCapture Cloud REST API task status](/ja/flexi-capture/rest-api-taskstatus)を参照してください。
  </Step>

  <Step title="検証 URL を作成する">
    タスクオブジェクトから `verification_id` を取得し、それを使用して次の形式の URL を作成します。

    ```text theme={null}
    https://{api-portal-host}/verification/{verification_id}
    ```

    ここで、`{api-portal-host}` はお使いのリージョンのホスト、`{verification_id}` は検証識別子です。例:

    ```text theme={null}
    https://cloud-us.flexicapture.com/verification/7bfb534eb05217799deb93d524cd8257
    ```
  </Step>

  <Step title="URL を開く">
    検証 URL をブラウザーまたは `<iframe>` 要素で開きます。

    <Note>
      検証 URL を開くために追加の認証は必要ありません。
    </Note>
  </Step>

  <Step title="完了メッセージを待つ">
    `<iframe>` 要素から送信される `FC_Verification_TaskClosed` メッセージを待ちます。このメッセージは、検証が完了したことを示します (詳細については、以下の[iframe 要素イベント](#iframeevents)を参照してください) 。
  </Step>

  <Step title="結果をダウンロードする">
    タスクのステータスを確認します。処理の完了後にファイルをダウンロードできます。
  </Step>
</Steps>

イベントログの表示方法と、エラーが発生して処理されたタスクを特定する方法については、[処理エラーの診断](/ja/flexi-capture/rest-api-tasks)を参照してください。

次のサンプルは、検証 ID を使用して検証 UI を開く方法を示しています。

```html theme={null}
<html style="min-height: 100%; height: 100%;">
<head>
  <script>
    var form;
    var verId;
    var btn;
    window.addEventListener("DOMContentLoaded", init, false);
    function init() {
      verId = document.getElementById("verificationId");
      btnFrm = document.getElementById("verifyFrame");
      btnWnd = document.getElementById("verifyWindow");
      btnFrm.addEventListener("click", verifyFrame, false);
      btnWnd.addEventListener("click", verifyWindow, false);
      window.addEventListener("message", receiveMessage, false);
    }
    function receiveMessage(event) {
      console.log(event.data);
      alert("isError: " + event.data.isError + "\nEvent: " + event.data.eventName);
    }
    function getUrl(id) {
      return "https://cloud-us.flexicapture.com/verification/" + verId.value;
    }
    function verifyWindow(evt) {
      evt.preventDefault();
      if (!verId.value) return alert("Verification id must be provided!");
      window.open(getUrl(), '_blank')
    }
    function verifyFrame(evt) {
      evt.preventDefault();
      if (!verId.value) return alert("Verification id must be provided!");
      var iframe = document.createElement("iframe");
      iframe.src = getUrl();
      iframe.style.width = "100%";
      iframe.style.height = "95%";
      try {
        document.getElementById("main").removeChild(document.querySelector("iframe"));
      } catch (e) { }
      document.getElementById("main").appendChild(iframe);
    }
  </script>
</head>
<body
  style="background-color: #999999; min-height: 100%; height: 100%; position: relative; margin: 0; padding: 0; background: linear-gradient(to bottom right, #4380bc, #5ba484);">
  <div id="main"
    style="height: 100%; position: relative; padding:20px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;">
    <form id="verifyForm">
      <input id="verificationId" placeholder="verification id" style="width: 250px;" />
      <button id="verifyFrame">Verify in frame</button>
      <button id="verifyWindow">Verify in window</button>
    </form>
  </div>
</body>
</html>
```

<a id="iframeevents" />

<div id="iframe-element-events">
  ## `<iframe>` 要素のイベント
</div>

以下のテーブルに、使用可能な `<iframe>` イベントを示します。

| Event                                   | Description                                                                                   |
| --------------------------------------- | --------------------------------------------------------------------------------------------- |
| `FC_Verification_TaskClosed`            | 検証が完了しました。REST API のタスク ステータスは、データをエクスポートする場合は "InProgress" に、ファイルをダウンロードする場合は "Done" に変わります。 |
| `FC_Verification_TaskRejected`          | タスクが却下され、キューに戻されました。                                                                          |
| `FC_Verification_TaskPostponed`         | タスクが延期され、キューに戻されました。                                                                          |
| `FC_Verification_TaskSentToException`   | タスクはエラーにより例外フォルダーに送られました。                                                                     |
| `FC_Verification_TaskSentToRecognition` | タスクは再認識ステージに送られました。                                                                           |
| `FC_Verification_TaskSentToStage`       | タスクは別のステージに送られました。                                                                            |
| `FC_Verification_TaskSentToRescan`      | タスクは再スキャンステージに送られました。                                                                         |

`<iframe>` 要素からメッセージを受信したら、検証 UI を閉じて、ユーザーをサードパーティシステムに戻すことができます。
