orchestrator
2024.10
true
UiPath logo, featuring letters U and I in white

Orchestrator API 指南

Automation CloudAutomation Cloud Public SectorAutomation SuiteStandalone
上次更新日期 2024年12月4日

队列项目请求

重要提示:
/QueueItems 端点对某个队列项目在队列链接到的所有文件夹中的每次重复进行计数,并返回 DTO。例如,如果链接到三 (3) 个文件夹的队列有一 (1) 个队列项目,则返回的队列项目数和计数为三 (1x3)。
要检索特定文件夹的结果,请使用 X-UiPath-OrganizationUnitId 标头。

从队列项目中删除特定内容值

/odata/QueueItems({key}) 端点的以下 PUT 请求允许您删除指定队列项目的特定内容,该内容可由 {key}标识。
重要提示: 您现在也可以删除状态为“ 成功”、“已删除”或 “重试” 状态的队列项目的特定内容。

API 端点

PUT https://{yourDomain}/odata/QueueItems({Id})

要删除特定内容,您需要将相应的值设置为 NULL 或空,而有效负载中的所有其他值都与处于成功状态的值匹配。 也就是说,您只需删除内容,而所有其他请求参数保持不变。

要了解 PUT 请求参数的值,请向/odata/QueueItems发出 GET 请求。 响应显示租户中的所有队列项目。

确定您感兴趣的队列项目,并复制以下参数的值:

  • “OrganizationUnitId”是包含队列项目的文件夹的 ID
  • “Id”是队列项目的 ID。 确保选择状态为“ 成功 ”的队列项目。

/odata/QueueItems({Id})发出第二个 GET 请求,并将 {Id} 替换为从上次 GET 调用中复制的队列项目 ID。 响应显示所需队列项目的数据。 复制以下参数的值:
  • 用于替换示例请求中 {the_Name_from_the_GET_response} 的“名称”
  • 用于替换示例请求中的 {the_Priority_from_the_GET_response} 的“优先级”
  • 用于替换示例请求中的 {the_DeferDate_from_the_GET_response} 的“推迟日期”
  • 用于替换示例请求中的 {the_DueDate_from_the_GET_response} 的“到期日期”
  • “RiskSlaDate”,用于替换示例请求中的 {the_RiskSlaDate_from_the_GET_response}
  • 用于替换示例请求中的 {the_Reference_from_the_GET_response} 的“引用”
  • 用于替换示例请求中的 {the_Progress_from_the_GET_response} 的“进度”
    注意: 您可以使用上述参数值填充 PUT 请求正文。

请求标头

--header 'Authorization: Bearer {access_token}'\)\)
--header 'Content-Type: application/json' \)\)
--header 'X-UIPATH-OrganizationUnitId: {the_ID_of_the_folder_that_contains_the_queue_item}' \)--header 'Authorization: Bearer {access_token}'\)\)
--header 'Content-Type: application/json' \)\)
--header 'X-UIPATH-OrganizationUnitId: {the_ID_of_the_folder_that_contains_the_queue_item}' \)

路径参数

参数

数据类型

描述

Id

(必填)

字符串

要从中删除特定内容的队列项目的 ID。

请求正文

请求正文包含要更新的队列项目信息,例如名称、优先级或引用。

注意: 对于此用例,您只需更新“SpecificContent”键的值。
{
      "Name": "{queue_name}", // String, the_name_of_the_container_queue
      "Priority": "{the_Priority_from_the_GET_response}",//String
    "SpecificContent": {}, // or NULL
      "DeferDate": "{the_DeferDate_from_the_GET_response}", // 2022-02-17T13:27:43.895Z
      "DueDate": "{the_DueDate_from_the_GET_response}", // 2022-02-17T13:27:43.895Z
      "RiskSlaDate": "{the_RiskSlaDate_from_the_GET_response}", // 2022-02-17T13:27:43.895Z
      "Reference": "{the_Reference_from_the_GET_response}", // String
      "Progress": "{the_Progress_from_the_GET_response}" // String
}{
      "Name": "{queue_name}", // String, the_name_of_the_container_queue
      "Priority": "{the_Priority_from_the_GET_response}",//String
    "SpecificContent": {}, // or NULL
      "DeferDate": "{the_DeferDate_from_the_GET_response}", // 2022-02-17T13:27:43.895Z
      "DueDate": "{the_DueDate_from_the_GET_response}", // 2022-02-17T13:27:43.895Z
      "RiskSlaDate": "{the_RiskSlaDate_from_the_GET_response}", // 2022-02-17T13:27:43.895Z
      "Reference": "{the_Reference_from_the_GET_response}", // String
      "Progress": "{the_Progress_from_the_GET_response}" // String
}

请求示例

假设您收集了构建 API 调用所需的所有信息。

获取队列项目 OrganizationUnitIdId

要查找文件夹和队列项目 ID,请向 /odata/QueueItems 端点发出 GET 请求:
curl --location --request GET '{OrchestratorURL}/odata/QueueItems' \
--header 'Authorization: Bearer 1234' \
--header 'Content-Type: application/json' \curl --location --request GET '{OrchestratorURL}/odata/QueueItems' \
--header 'Authorization: Bearer 1234' \
--header 'Content-Type: application/json' \

您可能会收到的响应示例:

{
  "value": [
    {
      "QueueDefinitionId": 29200,
      "OutputData": "{\"DynamicProperties\":{\"Prop1\":\"run\"}}",
      "AnalyticsData": null,
      "Status": "New",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "bc4e8fac-dc4b-4f77-8f20-13590e19ff26",
      "Reference": null,
      "ProcessingExceptionType": null,
      "DueDate": null,
      "RiskSlaDate": null,
      "Priority": "Normal",
      "DeferDate": null,
      "StartProcessing": "2022-02-16T15:30:12.13Z",
      "EndProcessing": "2022-02-16T15:30:12.46Z",
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{\"Prop2\":\"accelerate\"}}",
      "CreationTime": "2022-02-16T15:30:11.753Z",
      "Progress": null,
      "RowVersion": "AAAAAAB2liA=",
      "OrganizationUnitId": 62516,
      "OrganizationUnitFullyQualifiedName": "Banana",
      "Id": 3255808,
      "ProcessingException": null,
      "SpecificContent": {
        "Prop2": "Test demo"
      },
      "Output": {
        "Prop1": "vgdfdf"
      },
      "Analytics": null
    },
// other queue items data
    {
      "QueueDefinitionId": 3899,
      "OutputData": null,
      "AnalyticsData": null,
      "Status": "Successful",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "6ea50a9c-b657-4df3-bfe6-d1893c4f31ec",
      "Reference": "82086",
      "ProcessingExceptionType": null,
      "DueDate": null,
      "RiskSlaDate": "2022-02-17T13:27:43.895Z",
      "Priority": "High",
      "DeferDate": null,
      "StartProcessing": null,
      "EndProcessing": null,
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{\"EmployeeName\":\"John Kensington\",\"ContactNumber\":\"+4457899\",\"RelocationDistance\":500,\"Description\":\"Home relocation\",\"ExpenseCode\":\"UI234\",\"Amount\":1000,\"RequirePass\":true}}",
      "CreationTime": "2021-03-19T17:37:35.893Z",
      "Progress": null,
      "RowVersion": "AAAAAABQET4=",
      "OrganizationUnitId": 39419,
      "OrganizationUnitFullyQualifiedName": "Shared",
      "Id": 2499339,
      "ProcessingException": null,
      "SpecificContent": {
        "EmployeeName": "John Kensington",
        "ContactNumber": "+4457899",
        "RelocationDistance": 500,
        "Description": "Home relocation",
        "ExpenseCode": "UI234",
        "Amount": 1000,
        "RequirePass": true
      },
      "Output": null,
      "Analytics": null
    }
  ]
}{
  "value": [
    {
      "QueueDefinitionId": 29200,
      "OutputData": "{\"DynamicProperties\":{\"Prop1\":\"run\"}}",
      "AnalyticsData": null,
      "Status": "New",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "bc4e8fac-dc4b-4f77-8f20-13590e19ff26",
      "Reference": null,
      "ProcessingExceptionType": null,
      "DueDate": null,
      "RiskSlaDate": null,
      "Priority": "Normal",
      "DeferDate": null,
      "StartProcessing": "2022-02-16T15:30:12.13Z",
      "EndProcessing": "2022-02-16T15:30:12.46Z",
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{\"Prop2\":\"accelerate\"}}",
      "CreationTime": "2022-02-16T15:30:11.753Z",
      "Progress": null,
      "RowVersion": "AAAAAAB2liA=",
      "OrganizationUnitId": 62516,
      "OrganizationUnitFullyQualifiedName": "Banana",
      "Id": 3255808,
      "ProcessingException": null,
      "SpecificContent": {
        "Prop2": "Test demo"
      },
      "Output": {
        "Prop1": "vgdfdf"
      },
      "Analytics": null
    },
// other queue items data
    {
      "QueueDefinitionId": 3899,
      "OutputData": null,
      "AnalyticsData": null,
      "Status": "Successful",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "6ea50a9c-b657-4df3-bfe6-d1893c4f31ec",
      "Reference": "82086",
      "ProcessingExceptionType": null,
      "DueDate": null,
      "RiskSlaDate": "2022-02-17T13:27:43.895Z",
      "Priority": "High",
      "DeferDate": null,
      "StartProcessing": null,
      "EndProcessing": null,
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{\"EmployeeName\":\"John Kensington\",\"ContactNumber\":\"+4457899\",\"RelocationDistance\":500,\"Description\":\"Home relocation\",\"ExpenseCode\":\"UI234\",\"Amount\":1000,\"RequirePass\":true}}",
      "CreationTime": "2021-03-19T17:37:35.893Z",
      "Progress": null,
      "RowVersion": "AAAAAABQET4=",
      "OrganizationUnitId": 39419,
      "OrganizationUnitFullyQualifiedName": "Shared",
      "Id": 2499339,
      "ProcessingException": null,
      "SpecificContent": {
        "EmployeeName": "John Kensington",
        "ContactNumber": "+4457899",
        "RelocationDistance": 500,
        "Description": "Home relocation",
        "ExpenseCode": "UI234",
        "Amount": 1000,
        "RequirePass": true
      },
      "Output": null,
      "Analytics": null
    }
  ]
}

识别 成功 的队列项目并复制以下值:

  • "OrganizationUnitId" : 39419
  • "Id": 2499339

获取所需的队列项目数据

/odata/QueueItems({Id}) 端点发出 GET 请求:
  • 将 {Id} 替换为先前找到的 ID 的值(即 2499339)
  • 使用 X-UIPATH-OrganizationUnitId 请求标头并输入先前找到的 OrganizationUnitId 的值(即 39419)
    curl --location --request GET '{OrchestratorURL}/odata/QueueItems(2499339)' \
    --header 'Authorization: Bearer 1234' \
    --header 'Content-Type: application/json' \
    --header 'X-UIPATH-OrganizationUnitId: 39419'curl --location --request GET '{OrchestratorURL}/odata/QueueItems(2499339)' \
    --header 'Authorization: Bearer 1234' \
    --header 'Content-Type: application/json' \
    --header 'X-UIPATH-OrganizationUnitId: 39419'

    您可能会收到的响应示例:

    {
      "QueueDefinitionId": 3899,
      "OutputData": null,
      "AnalyticsData": null,
      "Status": "Successful",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "6ea50a9c-b657-4df3-bfe6-d1893c4f31ec",
      "Reference": "82086",
      "ProcessingExceptionType": null,
      "DueDate": null,
      "RiskSlaDate": "2022-02-17T13:27:43.895Z",
      "Priority": "High",
      "DeferDate": null,
      "StartProcessing": null,
      "EndProcessing": null,
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{\"EmployeeName\":\"John Kensington\",\"ContactNumber\":\"+4457899\",\"RelocationDistance\":500,\"Description\":\"Home relocation\",\"ExpenseCode\":\"UI234\",\"Amount\":1000,\"RequirePass\":true}}",
      "CreationTime": "2021-03-19T17:37:35.893Z",
      "Progress": null,
      "RowVersion": "AAAAAABQET4=",
      "OrganizationUnitId": 39419,
      "OrganizationUnitFullyQualifiedName": null,
      "Id": 2499339,
      "ProcessingException": null,
      "SpecificContent": {
        "EmployeeName": "John Kensington",
        "ContactNumber": "+4457899",
        "RelocationDistance": 500,
        "Description": "Home relocation",
        "ExpenseCode": "UI234",
        "Amount": 1000,
        "RequirePass": true
      },
      "Output": null,
      "Analytics": null
    }{
      "QueueDefinitionId": 3899,
      "OutputData": null,
      "AnalyticsData": null,
      "Status": "Successful",
      "ReviewStatus": "None",
      "ReviewerUserId": null,
      "Key": "6ea50a9c-b657-4df3-bfe6-d1893c4f31ec",
      "Reference": "82086",
      "ProcessingExceptionType": null,
      "DueDate": null,
      "RiskSlaDate": "2022-02-17T13:27:43.895Z",
      "Priority": "High",
      "DeferDate": null,
      "StartProcessing": null,
      "EndProcessing": null,
      "SecondsInPreviousAttempts": 0,
      "AncestorId": null,
      "RetryNumber": 0,
      "SpecificData": "{\"DynamicProperties\":{\"EmployeeName\":\"John Kensington\",\"ContactNumber\":\"+4457899\",\"RelocationDistance\":500,\"Description\":\"Home relocation\",\"ExpenseCode\":\"UI234\",\"Amount\":1000,\"RequirePass\":true}}",
      "CreationTime": "2021-03-19T17:37:35.893Z",
      "Progress": null,
      "RowVersion": "AAAAAABQET4=",
      "OrganizationUnitId": 39419,
      "OrganizationUnitFullyQualifiedName": null,
      "Id": 2499339,
      "ProcessingException": null,
      "SpecificContent": {
        "EmployeeName": "John Kensington",
        "ContactNumber": "+4457899",
        "RelocationDistance": 500,
        "Description": "Home relocation",
        "ExpenseCode": "UI234",
        "Amount": 1000,
        "RequirePass": true
      },
      "Output": null,
      "Analytics": null
    }

复制以下值:

  • "Priority" : "High"
  • "DeferDate" : null
  • "DueDate" : null
  • "RiskSlaDate": "2022-02-17T13:27:43.895Z"
  • "Reference" : "82086"
  • "Progress" : null

删除 SpecificContent

发出 PUT 请求,如下所示:

curl --location --request PUT '{OrchestratorURL}/odata/QueueItems(2499339)' \
--header 'Authorization: Bearer 1234' \
--header 'Content-Type: application/json' \
--header 'X-UIPATH-OrganizationUnitId: 39419'\
--data-raw '{
      "Name": "    Queue Demo", 
      "Priority": "High", 
    "SpecificContent": {},
      "DeferDate": null,
      "DueDate": null,
      "RiskSlaDate": "2022-02-17T13:27:43.895Z",
      "Reference": "82086",
      "Progress": null
}'curl --location --request PUT '{OrchestratorURL}/odata/QueueItems(2499339)' \
--header 'Authorization: Bearer 1234' \
--header 'Content-Type: application/json' \
--header 'X-UIPATH-OrganizationUnitId: 39419'\
--data-raw '{
      "Name": "    Queue Demo", 
      "Priority": "High", 
    "SpecificContent": {},
      "DeferDate": null,
      "DueDate": null,
      "RiskSlaDate": "2022-02-17T13:27:43.895Z",
      "Reference": "82086",
      "Progress": null
}'
注意: 请注意, SpecificContent 参数是唯一发生变化的参数,其值为 NULL 或空值,而其余值与 GET 响应中的值匹配。

在 Orchestrator 用户界面中,更改会显示在相应事务 ID 的“ 事务 详细信息”中。



导出队列项目

此操作需要调用各个端点。

备注:

此端点限制为每个租户每天 100 个 API 请求。

  1. 通过调用 POST https://{yourDomain}/ /odata/QueueDefinitions 来启动导出。根据需要添加筛选器。

    请求正文如下所示:

    POST https://{yourDomain}/odata/QueueDefinitions(27965)/UiPathODataSvc.Export?$filter=((QueueDefinitionId%20eq%2027965))&$expand=Robot,ReviewerUser HTTP/1.1
    
    Authorization: Bearer rt_45D8A3C5FF2AC56A92A906EE14FB0B8B004D76BAC67AE375521C373F23447684-1
    X-Uipath-Organizationunitid: 770643
    Content-Length: 0POST https://{yourDomain}/odata/QueueDefinitions(27965)/UiPathODataSvc.Export?$filter=((QueueDefinitionId%20eq%2027965))&$expand=Robot,ReviewerUser HTTP/1.1
    
    Authorization: Bearer rt_45D8A3C5FF2AC56A92A906EE14FB0B8B004D76BAC67AE375521C373F23447684-1
    X-Uipath-Organizationunitid: 770643
    Content-Length: 0

    响应包含后续步骤所需的 ID:

    {"@odata.context":"https://{yourDomain}/odata/$metadata#Exports/$entity","Id":8657,"Name":"MyQueue12345-items","Type":"Queues","Status":"New","RequestedAt":"2024-01-15T07:38:21.8891311Z","ExecutedAt":null,"Size":null}{"@odata.context":"https://{yourDomain}/odata/$metadata#Exports/$entity","Id":8657,"Name":"MyQueue12345-items","Type":"Queues","Status":"New","RequestedAt":"2024-01-15T07:38:21.8891311Z","ExecutedAt":null,"Size":null}
  2. 通过调用 GET https://{yourDomain}/orchestrator_/odata/Exports(8657) 来获取请求状态,其中括号之间的文本是在第 1 步中返回的 ID。

    请求正文如下所示:

    GET https://{yourDomain}/odata/Exports(8657) HTTP/1.1
    Host: alpha.uipath.com
    Authorization: Bearer rt_45D8A3C5FF2AC56A92A906EE14FB0B8B004D76BAC67AE375521C373F23447684-1
    X-Uipath-Organizationunitid: 770643
    Cookie: __cf_bm=SGYN6zxyBJpmMFjIxBCC8M2eZUvxXaEFqCiZtbidn00-1705304301-1-AUAOuQBjBD1bJQZXFHnyqzGZuBIyHkMpmedMwLZLMtRuGgsyCAsyTOaM8qVoi1meJ0/lRNX6BUZUfV7fWYZc43E=GET https://{yourDomain}/odata/Exports(8657) HTTP/1.1
    Host: alpha.uipath.com
    Authorization: Bearer rt_45D8A3C5FF2AC56A92A906EE14FB0B8B004D76BAC67AE375521C373F23447684-1
    X-Uipath-Organizationunitid: 770643
    Cookie: __cf_bm=SGYN6zxyBJpmMFjIxBCC8M2eZUvxXaEFqCiZtbidn00-1705304301-1-AUAOuQBjBD1bJQZXFHnyqzGZuBIyHkMpmedMwLZLMtRuGgsyCAsyTOaM8qVoi1meJ0/lRNX6BUZUfV7fWYZc43E=

    等待直至收到完整的响应:

    {"@odata.context":"https://{yourDomain}/odata/$metadata#Exports/$entity","Id":8657,"Name":"MyQueue12345-items","Type":"Queues","Status":"Completed","RequestedAt":"2024-01-15T07:37:02.783Z","ExecutedAt":"2024-01-15T07:37:05.553Z","Size":203226}{"@odata.context":"https://{yourDomain}/odata/$metadata#Exports/$entity","Id":8657,"Name":"MyQueue12345-items","Type":"Queues","Status":"Completed","RequestedAt":"2024-01-15T07:37:02.783Z","ExecutedAt":"2024-01-15T07:37:05.553Z","Size":203226}
  3. 通过调用 GET https://{yourDomain}/odata/Exports(8657)/UiPath.Server.Configuration.OData.GetDownloadLink 获取下载链接,其中括号之间的文本是在第 1 步中返回的 ID。

    请求正文如下所示:

    GET https://{yourDomain}/odata/Exports(8657)/UiPath.Server.Configuration.OData.GetDownloadLink HTTP/1.1
    Host: alpha.uipath.com
    Authorization: Bearer rt_45D8A3C5FF2AC56A92A906EE14FB0B8B004D76BAC67AE375521C373F23447684-1
    X-Uipath-Organizationunitid: 770643
    Cookie: __cf_bm=SGYN6zxyBJpmMFjIxBCC8M2eZUvxXaEFqCiZtbidn00-1705304301-1-AUAOuQBjBD1bJQZXFHnyqzGZuBIyHkMpmedMwLZLMtRuGgsyCAsyTOaM8qVoi1meJ0/lRNX6BUZUfV7fWYZc43E=GET https://{yourDomain}/odata/Exports(8657)/UiPath.Server.Configuration.OData.GetDownloadLink HTTP/1.1
    Host: alpha.uipath.com
    Authorization: Bearer rt_45D8A3C5FF2AC56A92A906EE14FB0B8B004D76BAC67AE375521C373F23447684-1
    X-Uipath-Organizationunitid: 770643
    Cookie: __cf_bm=SGYN6zxyBJpmMFjIxBCC8M2eZUvxXaEFqCiZtbidn00-1705304301-1-AUAOuQBjBD1bJQZXFHnyqzGZuBIyHkMpmedMwLZLMtRuGgsyCAsyTOaM8qVoi1meJ0/lRNX6BUZUfV7fWYZc43E=

    响应包含一个 URI,您可以使用该 URI 检索数据的 CSV 导出内容:

    {"@odata.context":"https://{yourDomain}/odata/$metadata#UiPath.Server.Configuration.OData.BlobFileAccessDto","Uri":"<Download URI>","Verb":"GET","RequiresAuth":false,"Headers":{"Keys":[],"Values":[]}}{"@odata.context":"https://{yourDomain}/odata/$metadata#UiPath.Server.Configuration.OData.BlobFileAccessDto","Uri":"<Download URI>","Verb":"GET","RequiresAuth":false,"Headers":{"Keys":[],"Values":[]}}
  4. 向第 3 步返回的 URI 发出 GET 请求。这将触发 CSV 导出文件的下载。有关格式和命名约定的详细信息,请参阅用户指南中的导出报告部分。
  • 从队列项目中删除特定内容值
  • API 端点
  • 请求标头
  • 路径参数
  • 请求正文
  • 请求示例
  • 导出队列项目

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo White
信任与安全
© 2005-2024 UiPath。保留所有权利。