Orchestrator API 指南
全局文本资产和每个机器人的文本资产最多支持 1,000,000 个字符。
$filter查询返回自定义筛选器的结果,该筛选器在contains函数中使用“名称”和“说明”参数。
检索特定资产
通过以下调用,您可以显示具有 DocAPITest 名称和 455 ID 的资产的所有可用信息。
获取
{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/Assets/UiPath.Server.Configuration.OData.GetRobotAsset(robotId='455',assetName='DocAPITest')
请求标头
| 密钥 | 值 |
|---|---|
| 授权 | 承载 |
响应代码
200 OK
响应正文
{
"@odata.context": "{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Application.Dto.Assets.RobotAssetDto",
"Name": "DocAPITest",
"ValueType": "Text",
"StringValue": "An asset added through an API call",
"BoolValue": false,
"IntValue": 0,
"CredentialUsername": "",
"CredentialPassword": ""
}
{
"@odata.context": "{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Application.Dto.Assets.RobotAssetDto",
"Name": "DocAPITest",
"ValueType": "Text",
"StringValue": "An asset added through an API call",
"BoolValue": false,
"IntValue": 0,
"CredentialUsername": "",
"CredentialPassword": ""
}
按名称检索特定资产
您可以使用GetAssetByName端点按名称检索特定资产。当您已经知道资产名称并希望在自动化工作流之外获取其值时,这非常有用。
获取
/api/Assets/name/{name}/value
请求标头
| 密钥 | 值 |
|---|---|
| 授权 | 承载 |
| X-UIPATH-OrganizationUnitId | 文件夹 ID |
请求示例
GET /api/Assets/name/Testing/value
Authorization: Bearer {access_token}
X-UIPATH-OrganizationUnitId: {folderId}
GET /api/Assets/name/Testing/value
Authorization: Bearer {access_token}
X-UIPATH-OrganizationUnitId: {folderId}
响应代码
200 OK
响应正文
{
"Name": "Testing",
"ValueType": "Credential",
"Value": "username: Testing",
"StringValue": "",
"BoolValue": false,
"IntValue": 0,
"SecretValue": "",
"CredentialUsername": "Testing",
"CredentialPassword": "Testing",
"ExternalName": null,
"CredentialStoreId": 1,
"KeyValueList": [],
"ConnectionData": null,
"Id": 1
}
{
"Name": "Testing",
"ValueType": "Credential",
"Value": "username: Testing",
"StringValue": "",
"BoolValue": false,
"IntValue": 0,
"SecretValue": "",
"CredentialUsername": "Testing",
"CredentialPassword": "Testing",
"ExternalName": null,
"CredentialStoreId": 1,
"KeyValueList": [],
"ConnectionData": null,
"Id": 1
}
按机器人检索资产
要对 /odata/Assets/UiPath.Server.Configuration.OData.GetRobotAssetByRobotId() 端点执行 GET 请求,您需要在 URL 中提供 robotId 和 assetName 。 请注意,系统仅返回每个机器人凭据资产的用户名,如以下示例所示。
获取
{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/Assets/UiPath.Server.Configuration.OData.GetRobotAssetByRobotId(robotId=193,assetName='Testing')
请求标头
| 密钥 | 值 |
|---|---|
| 授权 | 承载 |
响应代码
200 OK
响应正文
{
"@odata.context": "{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Application.Dto.Assets.RobotAssetDto",
"Name": "Testing",
"ValueType": "Credential",
"StringValue": "",
"BoolValue": false,
"IntValue": 0,
"CredentialUsername": "DocBot",
"CredentialPassword": ""
}
{
"@odata.context": "{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#UiPath.Application.Dto.Assets.RobotAssetDto",
"Name": "Testing",
"ValueType": "Credential",
"StringValue": "",
"BoolValue": false,
"IntValue": 0,
"CredentialUsername": "DocBot",
"CredentialPassword": ""
}
添加资产
以下示例使您能够创建文本类型的新全局资产。
发布
{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/Assets
请求标头
| 密钥 | 值 |
|---|---|
| 授权 | 承载 |
请求正文
{
"Name": "DocAPITest",
"ValueScope": "Global",
"ValueType": "Text",
"StringValue": "An asset added through an API call"
}
{
"Name": "DocAPITest",
"ValueScope": "Global",
"ValueType": "Text",
"StringValue": "An asset added through an API call"
}
响应代码
200 OK
响应正文
{
"@odata.context": "{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#Assets/$entity",
"Name": "DocAPITest",
"CanBeDeleted": true,
"ValueScope": "Global",
"ValueType": "Text",
"Value": "An asset added through an API call",
"StringValue": "An asset added through an API call",
"BoolValue": false,
"IntValue": 0,
"CredentialUsername": "",
"CredentialPassword": "",
"Id": 455,
"KeyValueList": []
}
{
"@odata.context": "{AutomationCloudURL}/{organizationName}/{tenantName}/orchestrator_/odata/$metadata#Assets/$entity",
"Name": "DocAPITest",
"CanBeDeleted": true,
"ValueScope": "Global",
"ValueType": "Text",
"Value": "An asset added through an API call",
"StringValue": "An asset added through an API call",
"BoolValue": false,
"IntValue": 0,
"CredentialUsername": "",
"CredentialPassword": "",
"Id": 455,
"KeyValueList": []
}