- 入门指南
- Swagger 定义
- Orchestrator API 使用示例
使用 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 或其他脚本工具。
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.
- Log in to your Automation CloudTM account.
- 导航到“管理”>“租户”。“租户”页面会列出所有现有租户。
- 单击所需租户左侧的箭头以显示其可用服务。
- 单击 Orchestrator 服务的“API 访问”。“API 访问”窗口将打开,其中包含以下特定于服务的信息:
- “用户密钥”- 使您能够生成用于 API 或第三方应用程序的唯一登录密钥,以便代表您执行登录和操作。以前称为刷新令牌。
- 组织 ID - 您的组织名称。这是基本 URL 之后的名称。
- “租户名称”- 租户的显示名称。
-
客户端 ID - 特定于 Orchestrator 应用程序本身,对于特定平台上的所有用户和租户均相同。例如,https://cloud.uipath.com 上的所有租户都具有相同的客户端 ID 值。
不要关闭此窗口。您需要该信息才能进行身份验证调用。通过单击在每个字段旁边的“复制”按钮 复制值。
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"
}
{tenant_name}
、{client_ID}
和 {user_key}
值。
{access_token}
以备后用。
{access_token}
在 24 小时内有效。您必须使用 {refresh_token}
重新生成 {access_token}
;否则,您将收到 401 状态代码。
-
向
https://cloud.uipath.com/{organizationName}/{tenantName}/orchestrator_/odata/Settings/UiPath.Server.Configuration.OData.GetLicense
执行 GET 请求 -
将
{organization_name}
和{tenant_name}
替换为“API 访问权限”页面中的值。 -
将“授权”标头设置为
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}
- 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 之间的机器人日志条目。