UiPath Documentation
ixp
latest
false
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

Communications Mining 用户指南

上次更新日期 2026年4月1日

使用 API

备注:

我们努力使 API 可预测,并且易于使用和集成。如果您有任何可以帮助我们改进的反馈,或者遇到任何问题或意外行为,请联系支持团队。我们会尽快回复您。

API 端点

所有 API 请求都将作为 JSON 对象通过 HTTPS 发送到租户端点的 Communications Mining™。

备注:

您可以在中查看所有可用端点。此外,您可以查看API 教程

通过 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 令牌和外部应用程序(OAuth 客户端凭据)。

要获取开发者访问令牌,请按照以下步骤操作:

  1. 从 Automation Cloud 访问 IXP。

  2. 转到“管理”页面。

  3. 选择“我的帐户”

  4. “API 令牌”下,选择“重新生成”按钮,这将生成访问令牌。

    此图显示了“管理”页面上“API 令牌”部分下的“重新生成”按钮。

备注:

您一次只能激活一个 API 令牌。 生成新令牌将使前一个令牌失效。

您需要在进行的每个 API 调用中包含以下 HTTP 标头,其中$REINFER_TOKEN是您的 Communications Mining™ API 令牌。

Authorization: Bearer $REINFER_TOKEN
Authorization: Bearer $REINFER_TOKEN

示例中的 bash 示例假定您已将令牌保存在环境变量中。示例中的 Python 和节点示例假定令牌已通过您选择的配置解决方案存储在局部变量REINFER_TOKEN中。

重击

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 令牌的自动化或服务器到服务器集成,您可以使用带有客户端凭据流程的外部应用程序进行身份验证。

步骤 1:创建外部应用程序

管理员必须创建机密应用程序,并根据您需要访问的 API 配置所需的作用域。

所需作用域:

  • PM.User
  • PM.User.Read
  • Ixp.ApiAccess
重要提示:

创建应用程序 ID应用程序密码后,请立即保存,因为您日后无法检索密码。

有关完整说明,请参阅“管理外部应用程序”

步骤 2: 分配应用程序权限

创建外部应用程序后,您必须为其分配适当的权限,然后其才能访问资源。

  1. 在 UiPath 环境中导航至 IXP 中的“管理访问权限”页面。
  2. 按您在创建应用程序时指定的名称搜索应用程序。
  3. 为应用程序分配必要的角色。该应用程序将像普通用户一样显示在列表中。
  4. 保存角色分配情况。

有关完整的权限分配详细信息,请查看“管理用户和组角色”

步骤 3:使用客户端凭据进行身份验证流程

使用客户端凭据授予类型获取访问令牌。

必需参数:

  • grant_type=client_credentials
  • client_id={app_id} - 来自第 1 步
  • client_secret={app_secret} - 来自第 1 步
  • scope - 您在步骤 1 中配置的作用域(以空格分隔)

有关完整的身份验证详细信息,请查看外部应用程序 (OAuth)

步骤 4:使用访问令牌

获得访问令牌后,请将其包含在所有 API 请求的Authorization标头中。

Authorization: Bearer {access_token}
Authorization: Bearer {access_token}

请求示例:

curl -X GET "https://cloud.uipath.com/{organizationName}/{tenantName}/reinfer_/api/v1/datasets" \
  -H "Authorization: Bearer {access_token}" \
  -H "Accept: application/json"
curl -X GET "https://cloud.uipath.com/{organizationName}/{tenantName}/reinfer_/api/v1/datasets" \
  -H "Authorization: Bearer {access_token}" \
  -H "Accept: application/json"
备注:

{organizationName}{tenantName}{access_token}替换为您的实际值。

权限

中的每个 API 端点都列出了其所需的权限。要查看您拥有的权限,请转到“管理”页面上的“管理访问权限”选项卡。该选项卡显示您有权访问的项目以及您在每个项目中拥有的权限。

错误

我们使用传统 HTTP 响应代码来指示 API 请求成功或失败。通常, 2xx范围中的代码表示成功, 4xx范围中的代码表示由于提供的请求而导致的错误,而5xx范围中的代码表示 Communications Mining 存在问题。

该错误的请求还将返回status值为error (而不是ok的正文,以及描述错误的错误消息。

重击

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 所需的时间传达给 API。我们提供了一个指标total ,您可以使用该指标来衡量我们平台在没有网络请求延迟的情况下处理您的请求所花费的时间。

响应中显示的标头示例:

Server-Timing: total;dur=37.7
Server-Timing: total;dur=37.7

Server-Timing值始终以毫秒为单位,因此在本例中,具有此标头值的 API 请求在我们的平台上需要 37.7 毫秒才能得到处理。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新