UiPath Orchestrator API 的身份验证系统对本地用户使用持有者令牌,对目录用户使用 NTLM 身份验证。
By default, the bearer token expires after 30 minutes.
此页面上的说明仅适用于内部部署 Orchestrator API。 Automation Cloud Orchestrator 租户不支持 API 的基本身份验证。
If you are using the Orchestrator service in Automation Cloud, use the instructions in Consuming Cloud API instead.
通过持有者令牌进行本地用户身份验证
-
Make a POST request to the
{OrchestratorURL}/api/account/authenticateendpoint with your Orchestrator login credentials, as in the example below.POST
{OrchestratorURL}/api/account/authenticateRequest headers:
密钥 值 授权 承载 Request body:
{ "tenancyName" : "Documentation", "usernameOrEmailAddress" : "Documentation", "password" : "DocumentationAPItest" }{ "tenancyName" : "Documentation", "usernameOrEmailAddress" : "Documentation", "password" : "DocumentationAPItest" }Response code: 200 OK
Response body:
{ "result": "<BEARER_TOKEN>", "targetUrl": null, "success": true, "error": null, "unAuthorizedRequest": false, "__abp": true }{ "result": "<BEARER_TOKEN>", "targetUrl": null, "success": true, "error": null, "unAuthorizedRequest": false, "__abp": true } -
将 HTTP 响应的结果参数中的字符串复制到剪贴板。 这表示不记名令牌,可在以后的所有请求中使用,如下所示:
- As an Authorization header with the
Bearer xxxxxxxxxxxxxvalue, wherexxxxxxxxxxxxxrepresents the string previously copied; - 如果您的 API 测试工具支持,请选择持有者令牌授权类型,并输入先前复制的字符串。
- As an Authorization header with the
通过 NTLM 身份验证的域用户身份验证
To authenticate your requests using Windows credentials you need to use an API client that supports NTLM authentication, such as Postman.
-
Make a request to the desired endpoint specifying your Windows credentials in the dedicated API client. To change an NTLM auth header in Postman, navigate to the Auth tab, set the Type to NTLM Authentication, and fill in the Username and Password fields.
-
如果您的用户存在于多个租户中,请使用
X-UIPATH-TenantName标头指定确切的租户,否则将在已配置用户的第一个租户中执行请求。 以下示例说明了对 Finance 租户中{OrchestratorURL}/odata/Processes端点的GET请求。获取
{OrchestratorURL}/odata/ProcessesRequest headers:
密钥 值 授权 承载 X-UIPATH-TenantName 租户的名称。
例如,“财务”。Response code: 200 OK
Response body:
{ "@odata.context": "{OrchestratorURL}/odata/$metadata#Processes", "@odata.count": 2, "value": [ { "IsActive": false, "SupportsMultipleEntryPoints": false, "RequiresUserInteraction": true, "Title": null, "Version": "1.0.6981.35861", "Key": "QueueItemsProcessing:1.0.6981.35861", "Description": "Process items from an Orchestrator queue.", "Published": "2020-10-17T14:22:11.0566667Z", "IsLatestVersion": false, "OldVersion": null, "ReleaseNotes": null, "Authors": "petrina.smith", "ProjectType": "Undefined", "Id": "QueueItemsProcessing", "Arguments": { "Input": "[{\"name\":\"argument1\",\"type\":\"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":true},{\"name\":\"argument2\",\"type\":\"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"argument3\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":true}]", "Output": null } }, { "IsActive": false, "SupportsMultipleEntryPoints": false, "RequiresUserInteraction": false, "Title": "TestingSequence", "Version": "4.0.6", "Key": "TestingSequence:4.0.6", "Description": "Blank Process", "Published": "2020-10-17T13:04:06.6766667Z", "IsLatestVersion": false, "OldVersion": null, "ReleaseNotes": "Invoke WF Action Generator", "Authors": "petrina.smith", "ProjectType": "Process", "Id": "TestingSequence", "Arguments": { "Input": "[{\"name\":\"Name\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"Email\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"Product\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false}]", "Output": null } } ] }{ "@odata.context": "{OrchestratorURL}/odata/$metadata#Processes", "@odata.count": 2, "value": [ { "IsActive": false, "SupportsMultipleEntryPoints": false, "RequiresUserInteraction": true, "Title": null, "Version": "1.0.6981.35861", "Key": "QueueItemsProcessing:1.0.6981.35861", "Description": "Process items from an Orchestrator queue.", "Published": "2020-10-17T14:22:11.0566667Z", "IsLatestVersion": false, "OldVersion": null, "ReleaseNotes": null, "Authors": "petrina.smith", "ProjectType": "Undefined", "Id": "QueueItemsProcessing", "Arguments": { "Input": "[{\"name\":\"argument1\",\"type\":\"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":true},{\"name\":\"argument2\",\"type\":\"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"argument3\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":true}]", "Output": null } }, { "IsActive": false, "SupportsMultipleEntryPoints": false, "RequiresUserInteraction": false, "Title": "TestingSequence", "Version": "4.0.6", "Key": "TestingSequence:4.0.6", "Description": "Blank Process", "Published": "2020-10-17T13:04:06.6766667Z", "IsLatestVersion": false, "OldVersion": null, "ReleaseNotes": "Invoke WF Action Generator", "Authors": "petrina.smith", "ProjectType": "Process", "Id": "TestingSequence", "Arguments": { "Input": "[{\"name\":\"Name\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"Email\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false},{\"name\":\"Product\",\"type\":\"System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\",\"required\":false,\"hasDefault\":false}]", "Output": null } } ] }
Accessing Swagger
如果您使用 Swagger 试用我们的 API,只需在单独的选项卡中登录 Orchestrator 实例即可。
The Orchestrator API Swagger definition can be accessed by adding the /swagger/ui/index#/ suffix to your Orchestrator URL. For example, {baseURL2} /swagger/ui/index#/.
The Swagger authentication expires according to the parameters set in your Orchestrator instance. By default, it is set to 30 minutes. You can change it by modifying the value of the Auth.Cookie.Expire parameter, in the Web.config file.