UiPath Documentation
orchestrator
2022.10
false
Orchestrator API 指南
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

在 Swagger 中授权 API 调用

访问 Swagger

要访问 Orchestrator API Swagger,请将 /swagger/index.html 附加到 Orchestrator URL。例如 https://{yourDomain}/swagger/index.html

您在 Swagger 中看到的 API 直接取决于您使用的 Orchestrator 实例。要轻松地直接在 Swagger 中发出请求,请在另一个选项卡中登录 Orchestrator。

获取访问令牌

要通过 Orchestrator 实例中的 Swagger 用户界面授权 API 调用,请执行以下步骤:

  1. Look for the Authorize button at the top right corner of the Orchestrator API page (OrchestratorURL/swagger). If the lock is open, you are unauthorized.

    文档图像

  2. 单击“授权” 。系统将显示“可用授权”窗口。

    备注:

    我们目前支持一种名为 OAuth2 的授权方案。

  3. 系统会预先选择所有作用域,以便您可以在 Orchestrator API 中试验所有端点。 如果要限制对某些 API 的访问,请清除它们。

  4. 单击“授权” 。系统将显示一个新窗口,确认您已获得授权。

  5. 完成后,单击“关闭”或单击“X”以关闭“可用授权”窗口。“授权”按钮显示一个关闭的锁,表示您已获得授权。

正在发送请求

获得授权后,您可以对 Orchestrator API 资源发出请求,如下所示:

  1. 展开要用于执行操作的 Orchestrator API 资源。 已关闭的锁定表示您已获得授权。

    Figure 1. Unauthorized API resource

  2. 在展开的方法窗口中,选择“试用”。

  3. 根据需要指定参数值。

  4. 选择“执行”。请求已执行。“持有者授权”标头会自动用于您的请求。

    Figure 2. Bearer authorization header

生成新的访问令牌

当访问令牌过期时,您会收到 401: You are not authenticated! 响应。 您的请求仍存在不记名授权标头,但访问令牌已过期。 发生这种情况时,您需要使过期的令牌失效并生成新的访问令牌:

  1. Look for the Authorize button at the top right corner of the Orchestrator API page (OrchestratorURL/swagger). The lock should be closed.

    文档图像

  2. 单击“授权” ,然后在显示的“可用授权”页面上,单击“注销” ,以撤销过期令牌。

  3. Close the Available authorizations window by clicking Close or X and then obtain an access token as described on the Obtaining an access token section.

撤销访问权限

使用完 Swagger 用户界面后,您应该使已使用的访问令牌失效:

  1. Look for the Authorize button at the top right corner of the Orchestrator API page (OrchestratorURL/swagger). The lock should be closed, meaning you are authorized.
  2. 单击“授权”,然后在显示的“可用授权”页面上,单击“注销”。
  3. 单击“关闭”或 "X",关闭“可用授权”窗口。“授权”按钮显示打开的锁,表示您未获得授权。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新