Orchestrator
最新
False
横幅背景图像
Orchestrator API 指南
上次更新日期 2024年4月24日

使用 Cloud API

概述

UiPath Automation CloudTM has two mechanisms for consuming APIs:

  • getting the API access information from Automation CloudTM (described on this page)
  • registering an external application to use the OAuth flow ( information and instructions ).

Which mechanism to use? You can use whichever mechanism you want, but if your Automation CloudTM organization uses the Azure Active Directory model , you must register external applications in Automation CloudTM and use the OAuth flow.

备注:

All clients that used to connect to Orchestrator CE via API, or using PowerShell and other scripting tools, need to be updated in order to connect to the UiPath Automation CloudTM.

未更改私有云中安装的 On-premises Orchestrator 或 Orchestrator。连接到这些 Orchestrator 实例时,您可以像以前一样继续使用 API 集成、PowerShell 或其他脚本工具。

Getting the API Access Information From the Automation CloudTM UI

The Services page within your Automation CloudTM account enables you to access API specific information for each of your existing services, allowing you to easily find the information required for authenticating to your cloud-based Orchestrator services via API calls.

备注:

无论本地用户组织级别的角色如何,都可以查看 Orchestrator 服务的 API 访问权限信息。

目录用户无法查看 Orchestrator 服务的 API 访问信息,如下所述。相反,他们必须注册外部应用程序并使用 OAuth 流程。

  1. Log in to your Automation CloudTM account.
  2. 导航到“管理”>“租户”。“租户”页面会列出所有现有租户。
  3. 单击所需租户左侧的箭头以显示其可用服务。
  4. 单击 Orchestrator 服务的“API 访问”。“API 访问”窗口将打开,其中包含以下特定于服务的信息:
  • “用户密钥”- 使您能够生成用于 API 或第三方应用程序的唯一登录密钥,以便代表您执行登录和操作。以前称为刷新令牌
  • 组织 ID - 您的组织名称。这是基本 URL 之后的名称。
  • “租户名称”- 租户的显示名称。
  • 客户端 ID - 特定于 Orchestrator 应用程序本身,对于特定平台上的所有用户和租户均相同。例如,https://cloud.uipath.com 上的所有租户都具有相同的客户端 ID 值。



不要关闭此窗口。您需要该信息才能进行身份验证调用。通过单击在每个字段旁边的“复制”按钮 复制值。

Authenticating to Your Automation CloudTM Based Orchestrator Tenant

身份验证操作向 https://account.uipath.com/oauth/token发送 POST 请求。请求和响应应如以下示例所示:

发布

https://account.uipath.com/oauth/token

请求标头

密钥

授权

承载

请求正文

{
    "grant_type": "refresh_token",
    "client_id": "{client_ID}",
    "refresh_token": "{user_key}"
}{
    "grant_type": "refresh_token",
    "client_id": "{client_ID}",
    "refresh_token": "{user_key}"
}

响应代码

200 OK

响应正文

{
  "access_token": "{access_token}",
  "id_token": "{id_token}",
  "scope": "openid profile email offline_access",
  "expires_in": 86400,
  "token_type": "Bearer"
}{
  "access_token": "{access_token}",
  "id_token": "{id_token}",
  "scope": "openid profile email offline_access",
  "expires_in": 86400,
  "token_type": "Bearer"
}
注意:您可以从上一节所述的 API 访问页面获取 {tenant_name}{client_ID}{user_key} 值。
复制 {access_token} 以备后用。
重要提示:执行 Orchestrator API 调用所需的 {access_token} 在 24 小时内有效。您必须使用 {refresh_token} 重新生成 {access_token};否则,您将收到 401 状态代码。

执行 Orchestrator API 调用

  1. https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/Settings/UiPath.Server.Configuration.OData.GetLicense 执行 GET 请求
  2. {organization_name}{tenant_name} 替换为“API 访问权限”页面中的值。
  3. 将“授权”标头设置为 Bearer {access_token},并粘贴在上述过程中收到的 {access_token} 值。

发送请求后,您应该会从 Orchestrator 收到响应,其中包含此服务的许可证信息

请求和响应应如以下示例所示:

获取

https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/Settings/UiPath.Server.Configuration.OData.GetLicense

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
    "@odata.context": "https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Application.Dto.License.LicenseDto",
    "HostLicenseId": null,
    "Id": 0,
    "ExpireDate": 1622678399,
    "GracePeriodEndDate": 1622678399,
    "GracePeriod": null,
    "AttendedConcurrent": false,
    "DevelopmentConcurrent": false,
    "StudioXConcurrent": false,
    "LicensedFeatures": [],
    "IsRegistered": true,
    "IsExpired": false,
    "CreationTime": "2019-11-28T06:16:21.373Z",
    "Code": "d1c8-4785-55ace9a0c233",
    "Allowed": {
        "Unattended": 1,
        "Attended": 1,
        "NonProduction": 0,
        "Development": 1,
        "StudioX": 0
    },
    "Used": {
        "Unattended": 0,
        "Attended": 0,
        "NonProduction": 0,
        "Development": 1,
        "StudioX": 0
    }
}{
    "@odata.context": "https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Application.Dto.License.LicenseDto",
    "HostLicenseId": null,
    "Id": 0,
    "ExpireDate": 1622678399,
    "GracePeriodEndDate": 1622678399,
    "GracePeriod": null,
    "AttendedConcurrent": false,
    "DevelopmentConcurrent": false,
    "StudioXConcurrent": false,
    "LicensedFeatures": [],
    "IsRegistered": true,
    "IsExpired": false,
    "CreationTime": "2019-11-28T06:16:21.373Z",
    "Code": "d1c8-4785-55ace9a0c233",
    "Allowed": {
        "Unattended": 1,
        "Attended": 1,
        "NonProduction": 0,
        "Development": 1,
        "StudioX": 0
    },
    "Used": {
        "Unattended": 0,
        "Attended": 0,
        "NonProduction": 0,
        "Development": 1,
        "StudioX": 0
    }
}
重要提示:

初始授权后的所有 Orchestrator API 调用都必须转到 Orchestrator URL

它们必须包含以下标头:

  • Authorization: Bearer {access_token}
要访问文件夹中的资源,请记住在 HTTP 标头中添加 FolderIdFolderPath,如“构建 API 请求”页面中所述。例如:
  • X-UIPATH-OrganizationUnitId: {FolderId}
重要提示:

Note that, for Automation CloudTM Orchestrator services, the results displayed by the API requests are limited to 1,000 entries for each page.

您可以在请求中使用 $top$skip 参数来检索后续页面。例如,使用 GET https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/RobotLogs?$top=1000&$skip=2000 请求检索 2,001 到 3,000 之间的机器人日志条目。

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.