- 入门指南
- 身份验证
- Swagger 定义
- Orchestrator API
- 平台管理 API
访问 Swagger
要访问 Orchestrator API Swagger,请将 /swagger/index.html 附加到 Orchestrator URL。例如 https://{yourDomain}/swagger/index.html。
您在 Swagger 中看到的 API 直接取决于您使用的 Orchestrator 实例。要轻松地直接在 Swagger 中发出请求,请在另一个选项卡中登录 Orchestrator。
获取访问令牌
要通过 Orchestrator 实例中的 Swagger 用户界面授权 API 调用,请执行以下步骤:
-
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.
-
单击“授权” 。系统将显示“可用授权”窗口。
备注:我们目前支持一种名为 OAuth2 的授权方案。
-
系统会预先选择所有作用域,以便您可以在 Orchestrator API 中试验所有端点。 如果要限制对某些 API 的访问,请清除它们。
-
单击“授权” 。系统将显示一个新窗口,确认您已获得授权。
-
完成后,单击“关闭”或单击“X”以关闭“可用授权”窗口。“授权”按钮显示一个关闭的锁,表示您已获得授权。
正在发送请求
获得授权后,您可以对 Orchestrator API 资源发出请求,如下所示:
-
展开要用于执行操作的 Orchestrator API 资源。 已关闭的锁定表示您已获得授权。
Figure 1. Unauthorized API resource
-
在展开的方法窗口中,选择“试用”。
-
根据需要指定参数值。
-
选择“执行”。请求已执行。“持有者授权”标头会自动用于您的请求。
Figure 2. Bearer authorization header
生成新的访问令牌
当访问令牌过期时,您会收到 401: You are not authenticated! 响应。 您的请求仍存在不记名授权标头,但访问令牌已过期。 发生这种情况时,您需要使过期的令牌失效并生成新的访问令牌:
-
Look for the Authorize button at the top right corner of the Orchestrator API page (
OrchestratorURL/swagger). The lock should be closed.
-
单击“授权” ,然后在显示的“可用授权”页面上,单击“注销” ,以撤销过期令牌。
-
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 用户界面后,您应该使已使用的访问令牌失效:
- 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. - 单击“授权”,然后在显示的“可用授权”页面上,单击“注销”。
- 单击“关闭”或 "X",关闭“可用授权”窗口。“授权”按钮显示打开的锁,表示您未获得授权。