Communications Mining
最新
バナーの背景画像
Communications Mining 開発者ガイド
最終更新日 2024年5月17日

API を使用する

Communications Mining API へようこそ。 私たちは、APIを予測可能で使いやすく、簡単に統合できるよう努めています。 改善のためにできることがある場合、またはバグや予期しない動作が発生した場合は、 サポート にご連絡いただければ、できるだけ早くご連絡いたします。

利用可能なすべてのエンドポイントについては、 API リファレンスをご覧くださいAPIチュートリアルもあります。

API エンドポイント

すべての API 要求は、JSON オブジェクトとして Communications Mining の テナント エンドポイント に HTTPS 経由で送信されます。

UiPath を介してオンボードされたテナント

https://cloud.uipath.com/<my_uipath_organisation>/<my_uipath_tenant>/reinfer_/api/...https://cloud.uipath.com/<my_uipath_organisation>/<my_uipath_tenant>/reinfer_/api/...

Communications Mining を介してオンボードされたテナント:

https://<mydomain>.reinfer.io/api/...https://<mydomain>.reinfer.io/api/...
重要:

開発環境と運用環境

Communications Mining では、別々のテナントを持つか、同じテナント内の別々のプロジェクトに配置することによって、開発データと運用データとワークフローを分離できます。 いずれの場合も、データ アクセスは個別に許可されます (開発者が開発データへの管理者アクセス権を持ち、運用環境をより厳密に制御できるようにするため)。 別々のテナントを使用する場合、API エンドポイントは開発データと運用データごとに異なります。同じテナントで別々のプロジェクトを使用している場合は、その単一のテナントのエンドポイントが両方に使用されます。

認証

すべての API 要求には、要求を行うユーザーを識別するための認証が必要です。 認証はアクセス トークンによって提供されます。 開発者アクセス トークンは、[アカウントの管理] ページから取得できます。

注:

一度にアクティブにできる API トークンは 1 つだけです。 新しいトークンを生成すると、前のトークンは無効になります。

実行するすべての API 呼び出しに対して、次の HTTP ヘッダーを含める必要があります。 $REINFER_TOKEN は Communications Mining の API トークンです。
Authorization: Bearer $REINFER_TOKENAuthorization: Bearer $REINFER_TOKEN
API リファレンスの bash の例では、トークンが環境変数に保存されていることを前提としています。API リファレンスの Python と Node の例では、トークンがローカル変数に格納されていることを前提としています。REINFER_TOKEN、選択した構成ソリューションを介して。
  • bash
    curl -X GET 'https://<my_api_endpoint>/api/...' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X GET 'https://<my_api_endpoint>/api/...' \
        -H "Authorization: Bearer $REINFER_TOKEN"
  • ノード
    const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/...",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/...",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/...",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/...",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • レスポンス
    {
      "status": "ok"
    }{
      "status": "ok"
    }

権限

API リファレンスの各 API エンドポイントには、必要なアクセス許可が一覧表示されます。 [アカウントの管理] ページに移動して、自分が持っている権限を確認できます。 このページには、各プロジェクトでアクセスできる プロジェクト権限 が表示されます。

Error

従来のHTTP応答コードを使用して、APIリクエストの成功または失敗を示します。 一般に、 2xx 範囲のコードは成功を示し、 4xx 範囲のコードは指定された要求に起因するエラーを示し、 5xx 範囲のコードは Communications Mining プラットフォームに問題があることを示します。
また、error を要求すると、status 値が okではなく error の本文と、エラーを説明するエラー メッセージが返されます。
  • bash
    curl -X GET 'https://<my_api_endpoint>/api/v1/nonexistent_page' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X GET 'https://<my_api_endpoint>/api/v1/nonexistent_page' \
        -H "Authorization: Bearer $REINFER_TOKEN"
    
  • ノード
    const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/nonexistent_page",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • レスポンス
    {
      "message": "404 Not Found",
      "status": "error"
    }{
      "message": "404 Not Found",
      "status": "error"
    }

ネットワークの問題により、要求が Communications Mining に届く前に要求が失敗する可能性があります。 このような場合、受信する応答は、上記の Communications Mining のエラー応答とは異なるものになります。

パフォーマンスのタイミング

Server-Timing HTTP ヘッダーを使用して、API への要求が処理されるまでにかかる時間を通信します。1 つのメトリック totalが含まれており、これを使用して、ネットワーク要求の遅延なしにプラットフォームが要求を処理するのにかかった時間を測定することができます。

応答に表示されるヘッダーの例:

Server-Timing: total;dur=37.7Server-Timing: total;dur=37.7
Server-Timing 値は常にミリ秒単位であるため、この場合、このヘッダー値を含む API 要求が UiPath プラットフォームで処理されるまでに 37.7 ミリ秒かかりました。

Was this page helpful?

サポートを受ける
RPA について学ぶ - オートメーション コース
UiPath コミュニティ フォーラム
UiPath ロゴ (白)
信頼とセキュリティ
© 2005-2024 UiPath. All rights reserved.