Orchestrator
2021.10
False
  • 入门指南
  • Swagger 定义
  • Orchestrator API 使用示例
  • 平台管理 API
横幅背景图像
Orchestrator API 指南
上次更新日期 2024年4月19日

机器人请求

检索机器人状态

注意: 如果要提取 LicenseKey 参数的值,则必须向 /odata/Robots(Id) 端点发出 GET 请求。

根据其 ID

以下示例使您能够查看 ID 为 749 的机器人的当前状态。

获取

https://{yourDomain}/odata/Sessions?$top=10&$filter=Robot/Id eq 749&$select=State

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions(State)",
    "@odata.count": 1,
    "value": [
        {
            "State": "Available"
        }
    ]
}{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions(State)",
    "@odata.count": 1,
    "value": [
        {
            "State": "Available"
        }
    ]
}

根据其名称

以下示例使您能够使用 DocBot 名称查看机器人的当前状态。

获取

https://{yourDomain}/odata/Sessions?$top=10&$filter=Robot/Name eq 'DocBot'&$select=State

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions(State)",
    "@odata.count": 1,
    "value": [
        {
            "State": "Available"
        }
    ]
}{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions(State)",
    "@odata.count": 1,
    "value": [
        {
            "State": "Available"
        }
    ]
}

根据状态检索机器人信息:示例 1

以下示例请求前 10 个处于“可用”状态并在过去 2 分钟内发送了检测信号的机器人。 仅显示相关的机器人信息。 您可以使用“报告时间”参数检查检测信号,并将当前时间减去 2 分钟。 如您所知,如果机器人在过去 2 分钟内未发送检测信号,则会将其标记为无响应。

获取

https://{yourDomain}/odata/Sessions?$top=10&$filter=State eq 'Available' and ReportingTime gt 2018-03-05T03:48:04.147Z&$select=Robot&$expand=Robot

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions(Robot)",
    "@odata.count": 2,
    "value": [
        {
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "MBOBOC",
                "Name": "DocBot",
                "Username": "UIPATH\\MADALINA.BOBOC",
                "Description": null,
                "Type": "NonProduction",
                "Password": null,
                "RobotEnvironments": "doc_env,WR_env,Group1",
                "Id": 749,
                "ExecutionSettings": null
            }
        },
        {
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "midragomir",
                "Name": "mr-Rob",
                "Username": "uipath\\mircea.dragomir",
                "Description": "Alerts",
                "Type": "NonProduction",
                "Password": null,
                "RobotEnvironments": "",
                "Id": 902,
                "ExecutionSettings": null
            }
        }
    ]
}{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions(Robot)",
    "@odata.count": 2,
    "value": [
        {
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "MBOBOC",
                "Name": "DocBot",
                "Username": "UIPATH\\MADALINA.BOBOC",
                "Description": null,
                "Type": "NonProduction",
                "Password": null,
                "RobotEnvironments": "doc_env,WR_env,Group1",
                "Id": 749,
                "ExecutionSettings": null
            }
        },
        {
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "midragomir",
                "Name": "mr-Rob",
                "Username": "uipath\\mircea.dragomir",
                "Description": "Alerts",
                "Type": "NonProduction",
                "Password": null,
                "RobotEnvironments": "",
                "Id": 902,
                "ExecutionSettings": null
            }
        }
    ]
}

根据状态检索机器人信息:示例 2

以下示例查找状态为“已断开连接”的前 10 个机器人,并展开机器人信息。

获取

https://{yourDomain}/odata/Sessions?$top=10&$filter=State eq 'Disconnected'&$expand=Robot

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions",
    "@odata.count": 2,
    "value": [
        {
            "State": "Disconnected",
            "ReportingTime": "2018-01-15T18:47:07.93Z",
            "Info": null,
            "IsUnresponsive": false,
            "Id": 718,
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "DESKTOP-PMFQGCB",
                "Name": "Stan",
                "Username": "Alex",
                "Description": null,
                "Type": "Unattended",
                "Password": null,
                "RobotEnvironments": "doc_env,a_invoke_env,Group1",
                "Id": 759,
                "ExecutionSettings": null
            }
        },
        {
            "State": "Disconnected",
            "ReportingTime": "2018-01-18T18:14:14.34Z",
            "Info": null,
            "IsUnresponsive": false,
            "Id": 730,
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "DESKTOP-PMFQGCB",
                "Name": "!~#$%^&*()_+=-",
                "Username": "dragomirmir",
                "Description": null,
                "Type": "NonProduction",
                "Password": null,
                "RobotEnvironments": "WR_env",
                "Id": 771,
                "ExecutionSettings": null
            }
        }
    ]
}{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Sessions",
    "@odata.count": 2,
    "value": [
        {
            "State": "Disconnected",
            "ReportingTime": "2018-01-15T18:47:07.93Z",
            "Info": null,
            "IsUnresponsive": false,
            "Id": 718,
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "DESKTOP-PMFQGCB",
                "Name": "Stan",
                "Username": "Alex",
                "Description": null,
                "Type": "Unattended",
                "Password": null,
                "RobotEnvironments": "doc_env,a_invoke_env,Group1",
                "Id": 759,
                "ExecutionSettings": null
            }
        },
        {
            "State": "Disconnected",
            "ReportingTime": "2018-01-18T18:14:14.34Z",
            "Info": null,
            "IsUnresponsive": false,
            "Id": 730,
            "Robot": {
                    "LicenseKey": null,
                "MachineName": "DESKTOP-PMFQGCB",
                "Name": "!~#$%^&*()_+=-",
                "Username": "dragomirmir",
                "Description": null,
                "Type": "NonProduction",
                "Password": null,
                "RobotEnvironments": "WR_env",
                "Id": 771,
                "ExecutionSettings": null
            }
        }
    ]
}

根据 ID 检索机器人信息

以下示例检索 ID 为 216 的机器人的详细信息。 请注意,此机器人使用智能卡身份验证。

获取

https://{yourDomain}/odata/Robots(216)

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Robots/$entity",
    "LicenseKey": "fc157179-3724-4bb0-acd2-8261bef82d01",
    "MachineName": "CAPETRINA",
    "MachineId": 15,
    "Name": "Gustavee",
    "Username": "uipath\\john.smith",
    "ExternalName": null,
    "Description": null,
    "Type": "Development",
    "HostingType": "Standard",
    "ProvisionType": "Manual",
    "Password": null,
    "CredentialStoreId": null,
    "UserId": 45,
    "Enabled": true,
    "CredentialType": null,
    "RobotEnvironments": "",
    "IsExternalLicensed": false,
    "LimitConcurrentExecution": false,
    "Id": 216,
    "ExecutionSettings": {
        "ResolutionHeight": 0,
        "ResolutionDepth": 0,
        "FontSmoothing": false,
        "AutoDownloadProcess": false
    }
}{
    "@odata.context": "https://{yourDomain}/odata/$metadata#Robots/$entity",
    "LicenseKey": "fc157179-3724-4bb0-acd2-8261bef82d01",
    "MachineName": "CAPETRINA",
    "MachineId": 15,
    "Name": "Gustavee",
    "Username": "uipath\\john.smith",
    "ExternalName": null,
    "Description": null,
    "Type": "Development",
    "HostingType": "Standard",
    "ProvisionType": "Manual",
    "Password": null,
    "CredentialStoreId": null,
    "UserId": 45,
    "Enabled": true,
    "CredentialType": null,
    "RobotEnvironments": "",
    "IsExternalLicensed": false,
    "LimitConcurrentExecution": false,
    "Id": 216,
    "ExecutionSettings": {
        "ResolutionHeight": 0,
        "ResolutionDepth": 0,
        "FontSmoothing": false,
        "AutoDownloadProcess": false
    }
}

检索可以执行特定流程的所有机器人

以下示例向 /odata/Robots/UiPath.Server.Configuration.OData.GetRobotsForProcess发出请求。 它使您能够动态识别哪些机器人可以执行具有 input_output_arguments_example ID 的包。

获取

https://{yourDomain}/odata/Robots/UiPath.Server.Configuration.OData.GetRobotsForProcess(processId='input_output_arguments_example')

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
  "@odata.context": "https://{yourDomain}/odata/$metadata#Robots",
  "@odata.count": 2,
  "value": [
    {
      "LicenseKey": null,
      "MachineName": "DESKTOP-ASBD",
      "MachineId": 129,
      "Name": "Stan",
      "Username": "Alex",
      "Description": null,
      "Version": null,
      "Type": "Unattended",
      "HostingType": "Standard",
      "Password": null,
      "RobotEnvironments": "doc_env,a_invoke_env,Group1",
      "Id": 759,
      "ExecutionSettings": null
    },
    {
      "LicenseKey": null,
      "MachineName": "Doc",
      "MachineId": 1066,
      "Name": "DocBot",
      "Username": "uipath\\documentation",
      "Description": null,
      "Version": "18.3.0.558",
      "Type": "NonProduction",
      "HostingType": "Standard",
      "Password": null,
      "RobotEnvironments": "doc_env",
      "Id": 1684,
      "ExecutionSettings": null
    }
  ]
}{
  "@odata.context": "https://{yourDomain}/odata/$metadata#Robots",
  "@odata.count": 2,
  "value": [
    {
      "LicenseKey": null,
      "MachineName": "DESKTOP-ASBD",
      "MachineId": 129,
      "Name": "Stan",
      "Username": "Alex",
      "Description": null,
      "Version": null,
      "Type": "Unattended",
      "HostingType": "Standard",
      "Password": null,
      "RobotEnvironments": "doc_env,a_invoke_env,Group1",
      "Id": 759,
      "ExecutionSettings": null
    },
    {
      "LicenseKey": null,
      "MachineName": "Doc",
      "MachineId": 1066,
      "Name": "DocBot",
      "Username": "uipath\\documentation",
      "Description": null,
      "Version": "18.3.0.558",
      "Type": "NonProduction",
      "HostingType": "Standard",
      "Password": null,
      "RobotEnvironments": "doc_env",
      "Id": 1684,
      "ExecutionSettings": null
    }
  ]
}

根据机器人名称检索机器人日志

以下示例使您能够查看名为 DocBot 的机器人的机器人日志。

获取

https://{yourDomain}/odata/RobotLogs?$top=100&$skip=200&$filter=RobotName eq 'DocBot'

请求标头

密钥

授权

承载

响应代码

200 OK

响应正文

{
    "@odata.context": "https://{yourDomain}/odata/$metadata#RobotLogs",
    "@odata.count": 202,
    "value": [
        {
            "Level": "Info",
            "WindowsIdentity": "UIPATH\\john.smith",
            "ProcessName": "TestingSequence_DOC",
            "TimeStamp": "2019-10-14T13:55:18.2473626Z",
            "Message": "TestingSequence_DOC execution started",
            "JobKey": "e49c0012-ee01-45e4-884c-0ce1f2aa6fbb",
            "RawMessage": "{\r\n  \"message\": \"TestingSequence_DOC execution started\",\r\n  \"level\": \"Information\",\r\n  \"logType\": \"Default\",\r\n  \"timeStamp\": \"2019-10-14T13:55:18.2473626+00:00\",\r\n  \"fingerprint\": \"972a32c3-95d9-4264-ae5d-af589bf4f0b5\",\r\n  \"windowsIdentity\": \"UIPATH\\\\petrina.calota\",\r\n  \"machineName\": \"LAPTOP-IN7198N3\",\r\n  \"processName\": \"TestingSequence_DOC\",\r\n  \"processVersion\": \"1.1.7024.37929\",\r\n  \"jobId\": \"e49c0012-ee01-45e4-884c-0ce1f2aa6fbb\",\r\n  \"robotName\": \"G\",\r\n  \"machineId\": 229978,\r\n  \"organizationUnitId\": 67543,\r\n  \"fileName\": \"Main\"\r\n}",
            "RobotName": "DocBot",
            "MachineId": 229978,
            "Id": 0
        },
        {
            "Level": "Info",
            "WindowsIdentity": "UIPATH\\john.smith",
            "ProcessName": "TestingSequence_DOC",
            "TimeStamp": "2019-10-14T13:57:21.4985672Z",
            "Message": "TestingSequence_DOC execution ended",
            "JobKey": "e49c0012-ee01-45e4-884c-0ce1f2aa6fbb",
            "RawMessage": "{\r\n  \"message\": \"TestingSequence_DOC execution ended\",\r\n  \"level\": \"Information\",\r\n  \"logType\": \"Default\",\r\n  \"timeStamp\": \"2019-10-14T13:57:21.4985672+00:00\",\r\n  \"fingerprint\": \"e973b4f2-deec-4290-978b-3a8af0769b35\",\r\n  \"windowsIdentity\": \"UIPATH\\\\petrina.calota\",\r\n  \"machineName\": \"LAPTOP-IN7198N3\",\r\n  \"processName\": \"TestingSequence_DOC\",\r\n  \"processVersion\": \"1.1.7024.37929\",\r\n  \"jobId\": \"e49c0012-ee01-45e4-884c-0ce1f2aa6fbb\",\r\n  \"robotName\": \"G\",\r\n  \"machineId\": 229978,\r\n  \"organizationUnitId\": 67543,\r\n  \"totalExecutionTimeInSeconds\": 123,\r\n  \"totalExecutionTime\": \"00:02:03\",\r\n  \"fileName\": \"Main\"\r\n}",
            "RobotName": "DocBot",
            "MachineId": 229978,
            "Id": 0
        }
  ]
}{
    "@odata.context": "https://{yourDomain}/odata/$metadata#RobotLogs",
    "@odata.count": 202,
    "value": [
        {
            "Level": "Info",
            "WindowsIdentity": "UIPATH\\john.smith",
            "ProcessName": "TestingSequence_DOC",
            "TimeStamp": "2019-10-14T13:55:18.2473626Z",
            "Message": "TestingSequence_DOC execution started",
            "JobKey": "e49c0012-ee01-45e4-884c-0ce1f2aa6fbb",
            "RawMessage": "{\r\n  \"message\": \"TestingSequence_DOC execution started\",\r\n  \"level\": \"Information\",\r\n  \"logType\": \"Default\",\r\n  \"timeStamp\": \"2019-10-14T13:55:18.2473626+00:00\",\r\n  \"fingerprint\": \"972a32c3-95d9-4264-ae5d-af589bf4f0b5\",\r\n  \"windowsIdentity\": \"UIPATH\\\\petrina.calota\",\r\n  \"machineName\": \"LAPTOP-IN7198N3\",\r\n  \"processName\": \"TestingSequence_DOC\",\r\n  \"processVersion\": \"1.1.7024.37929\",\r\n  \"jobId\": \"e49c0012-ee01-45e4-884c-0ce1f2aa6fbb\",\r\n  \"robotName\": \"G\",\r\n  \"machineId\": 229978,\r\n  \"organizationUnitId\": 67543,\r\n  \"fileName\": \"Main\"\r\n}",
            "RobotName": "DocBot",
            "MachineId": 229978,
            "Id": 0
        },
        {
            "Level": "Info",
            "WindowsIdentity": "UIPATH\\john.smith",
            "ProcessName": "TestingSequence_DOC",
            "TimeStamp": "2019-10-14T13:57:21.4985672Z",
            "Message": "TestingSequence_DOC execution ended",
            "JobKey": "e49c0012-ee01-45e4-884c-0ce1f2aa6fbb",
            "RawMessage": "{\r\n  \"message\": \"TestingSequence_DOC execution ended\",\r\n  \"level\": \"Information\",\r\n  \"logType\": \"Default\",\r\n  \"timeStamp\": \"2019-10-14T13:57:21.4985672+00:00\",\r\n  \"fingerprint\": \"e973b4f2-deec-4290-978b-3a8af0769b35\",\r\n  \"windowsIdentity\": \"UIPATH\\\\petrina.calota\",\r\n  \"machineName\": \"LAPTOP-IN7198N3\",\r\n  \"processName\": \"TestingSequence_DOC\",\r\n  \"processVersion\": \"1.1.7024.37929\",\r\n  \"jobId\": \"e49c0012-ee01-45e4-884c-0ce1f2aa6fbb\",\r\n  \"robotName\": \"G\",\r\n  \"machineId\": 229978,\r\n  \"organizationUnitId\": 67543,\r\n  \"totalExecutionTimeInSeconds\": 123,\r\n  \"totalExecutionTime\": \"00:02:03\",\r\n  \"fileName\": \"Main\"\r\n}",
            "RobotName": "DocBot",
            "MachineId": 229978,
            "Id": 0
        }
  ]
}
备注:

针对使用 Elasticsearch 存储的机器人日志的 GET 请求仅检索前 10000 个条目。 这是由于 Elasticsearch 的限制,如果您使用的是 SQL,则不会发生这种情况。

使用超过 10,000 个限制的 $top$skip 参数将返回以下错误消息:“在 Elasticsearch 中,分页深度受 max_result_window 索引设置的限制。 确保“跳过 + 拍摄”小于 10000”。
参数化对使用 Elasticsearch 存储的机器人日志的请求时,仅支持以下条件动词组合: RobotName eqJobKey eqMachineId eqLevel geTimeStamp gt

编辑机器人信息

以下示例更改 ID 为 749 的机器人的类型和名称,并修改其执行设置配置。 请记住将 X-UIPATH-OrganizationUnitId 放入请求标头中,并将机器人 ID 和计算机名称放入请求正文中。
备注:

向机器人端点发出 PUT 请求时,请考虑以下事项:

  • 当您发送相同的用户名和空密码或空密码时,机器人用户名和密码不会更新。
  • 如果发送的新用户名密码为 null 或空,则机器人凭据将更新并使用新用户名。

放置

https://{yourDomain}/odata/Robots(749)

请求标头

密钥

授权

承载

X-UIPATH-OrganizationUnitId

容器文件夹 ID。

例如 36886

请求正文

{
  "LicenseKey": "8ec4t984-b2d7-44f2-b5be-0a64ee9a487b",
  "MachineName": "MBOBOC",
  "Name": "DocBot",
  "Type": "Development",
  "Id": 749,
  "Username": "UIPATH\\JustAnotherRobot",
  "ExecutionSettings":{
        "TracingLevel":"Information",
        "StudioNotifyServer":true,
        "LoginToConsole":false,
        "ResolutionWidth":0,
        "ResolutionHeight":0,
        "ResolutionDepth":0,
        "FontSmoothing":false,
        "AutoDownloadProcess":false
    }
}{
  "LicenseKey": "8ec4t984-b2d7-44f2-b5be-0a64ee9a487b",
  "MachineName": "MBOBOC",
  "Name": "DocBot",
  "Type": "Development",
  "Id": 749,
  "Username": "UIPATH\\JustAnotherRobot",
  "ExecutionSettings":{
        "TracingLevel":"Information",
        "StudioNotifyServer":true,
        "LoginToConsole":false,
        "ResolutionWidth":0,
        "ResolutionHeight":0,
        "ResolutionDepth":0,
        "FontSmoothing":false,
        "AutoDownloadProcess":false
    }
}

响应代码

200 OK

删除机器人

删除单个机器人

要删除特定机器人,请向 odata/Robots({robot_id}) 端点执行 DELETE 请求。

删除

https://{yourDomain}/odata/Robots(79)

请求标头

密钥

授权

承载

响应代码

204 无内容

删除多个机器人

要同时删除多个机器人,请向 /Robots/UiPath.Server.Configuration.OData.DeleteBulk 端点执行 POST 请求。

发布

https://{yourDomain}/odata/Robots/UiPath.Server.Configuration.OData.DeleteBulk

请求标头

密钥

授权

承载

请求正文

{
    "robotIds": [119, 120]
}{
    "robotIds": [119, 120]
}

响应代码

204 无内容

更新您自己的无人值守机器人的密码

通过输入您的用户 ID(例如,假设您的用户 ID 为 88),调用下面的端点会更新您自己的无人值守机器人的密码。 此操作不需要 用户的“编辑”权限。

注意: 如果要更新其他机器人的密码,请使用相应用户的 ID 向同一端点发出 PUT 请求。

补丁

https://{yourDomain}/odata/Users(88)

请求标头

密钥

授权

承载

请求正文

{
"UnattendedRobot": 
   {
    "Password": "newUnattendedRobotP@ss"
    }
}{
"UnattendedRobot": 
   {
    "Password": "newUnattendedRobotP@ss"
    }
}

响应代码

200 OK

此页面是否有帮助?

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