UiPath API接口说明
Swagger网址
私有云网址(企业版)
https://企业/swagger/index.html
公有云网址(社区版)
https://cloud.uipath.com/linan/LinanZhang/orchestrator_/swagger/index.html#/
常见问题
-
Swagger页面测试请求时报错“You are not authenticated!”
解决:先登录OC,再打开Swagger
Parameters
filter 根据值来筛选
如果希望根据Title来搜索可以在输入$filter中输入如下(value用单引号括起来):
title eq 'Fin_Commercial_OneStopShop_001_KADD'
请求地址
https://uipathoc.ab.cn/odata/Processes?$Filter=title eq 'ClassicFolder'
top 显示返回的结果集数量
如果只希望返回2条结果,可以输入如下
请求地址
https://uipathoc.ab.cn/odata/Releases**?$top=2**
Account
获取token
方法:POST
请求地址:https://uipathoc.ab.cn/api/Account/Authenticate
请求体:
tenancyName:租户名(BCC所有的租户名均为null)
username:用户名
password:用户密码
{
"tenancyName": null,
"usernameOrEmailAddress": "zhanglinan",
"password": "your_password"
}
响应体:
result:token
{
"result": "eyJhbGciOiJSUzI1NiIsImtpZCI6IkQ0NzJDRTcwNzdBOTE5Mjc3MzExRTA5Q0I2RkEyODE4NkREMDNGNkIiLCJ0eXAiOiJKV1QiLCJ4NXQiOiIxSExPY0hlcEdTZHpFZUNjdHZvb0dHM1FQMnMifQ.eyJuYmYiOjE2NjA4ODg4MjksImV4cCI6MTY2MDg5MjcyOSwiaXNzIjoiaHR0cHM6Ly91aXBhdGhvYy5hYi1pbmJldi5jbi9pZGVudGl0eSIsImF1ZCI6WyJJZGVudGl0eVNlcnZlckFwaSIsIk9yY2hlc3RyYXRvckFwaVVzZXJBY2Nlc3MiXSwiY2xpZW50X2lkIjoiNGQ3ZjJiZjItOTA5My00OTU5LTlkNTItYjRhNjYwZjE0ODVmIiwic3ViIjoiZWJjZjBiZDQtN2ViOS00NmZkLWIyMDMtNzkyMDdkYjE5NTkxIiwiYXV0aF90aW1lIjoxNjYwODg5MTI5LCJpZHAiOiJsb2NhbCIsIkFzcE5ldC5JZGVudGl0eS5TZWN1cml0eVN0YW1wIjoiNVIzRE1NSUJLN1FSTkJXMlFPU1hHUUlQRUFXSE1WVEciLCJwcnRfaWQiOiJkZGM0YTM3YS00N2M5LTQxZDEtOGRkZi05ZGViNmNiNGNmNjUiLCJob3N0IjoiRmFsc2UiLCJmaXJzdF9uYW1lIjoibGluYW4iLCJsYXN0X25hbWUiOiJ6aGFuZyIsInBydF9hZG0iOiJGYWxzZSIsInByZWZlcnJlZF91c2VybmFtZSI6InpoYW5nbGluYW4iLCJuYW1lIjoiemhhbmdsaW5hbiIsInNjb3BlIjpbImVtYWlsIiwib3BlbmlkIiwicHJvZmlsZSIsInRlbmFudCIsIklkZW50aXR5U2VydmVyQXBpIiwiT3JjaGVzdHJhdG9yQXBpVXNlckFjY2VzcyJdLCJhbXIiOlsicHdkIl19.YhDrcPhEFTHcXXQdnvAywYKPa0ng6wWbVqEO_g9qQs72dA_puvWk-KDZUrWbhzOfLGdoKi29ao23fm9c-C8r1o9LEYYSBYFjWAUNGiJ9-KWSQs1fs-CrKdk0iVd71pOeDN4-P7c6wTzfZ7pqBU6BofyXyugw0oWuDIoGHQorbtE4ZIcot3y9YD866zyK9wNaHRKEC_rS3_AoQrEvQBlu5sxI7wXFTpAxNeexZDI9JuYLDWKsI3qQ9nj_ioFpB1Ruukmng3Uc4bbJNdxdWmAXnO8ASeG1bc68Lf-H015pn9fXu4HabDzstDmrkXTvhTIVo4kXy14ooJnHxdEjREnhoA",
"targetUrl": null,
"success": true,
"error": null,
"unAuthorizedRequest": false,
"__abp": true
}
Users
获取用户信息
方法:GET
请求地址:https://uipathoc.ab.cn/odata/Users
请求头:Authorization:Bearer+空格+token
响应体:
{
"@odata.context": "https://uipathoc.ab.cn/odata/$metadata#Users",
"@odata.count": 1,
"value": [
{
"Name": "linan",
"Surname": "zhang",
"UserName": "zhanglinan",
"Domain": null,
"DirectoryIdentifier": null,
"FullName": "linan zhang",
"EmailAddress": "",
"IsEmailConfirmed": false,
"LastLoginTime": "2022-09-06T13:56:57.073Z",
"IsActive": true,
"CreationTime": "2022-08-17T08:36:29.45Z",
"AuthenticationSource": "local",
"Password": null,
"IsExternalLicensed": false,
"RolesList": [
"Allow to be Folder Administrator",
"Allow to be Automation User",
"Robot"
],
"LoginProviders": [],
"TenantId": 1,
"TenancyName": null,
"TenantDisplayName": null,
"TenantKey": null,
"Type": "DirectoryUser",
"ProvisionType": "Manual",
"LicenseType": null,
"Key": "ebcf0bd4-7eb9-46fd-b203-79207db19591",
"MayHaveUserSession": true,
"MayHaveRobotSession": false,
"MayHaveUnattendedSession": false,
"BypassBasicAuthRestriction": false,
"MayHavePersonalWorkspace": false,
"RestrictToPersonalWorkspace": false,
"Id": 98,
"RobotProvision": null,
"UnattendedRobot": null,
"NotificationSubscription": {
"Queues": true,
"Robots": true,
"Jobs": true,
"Schedules": true,
"Tasks": true,
"QueueItems": true,
"Insights": false,
"CloudRobots": true
},
"UpdatePolicy": null
}
]
}
Processes(包)
获取包
方法:GET
请求地址:https://uipathoc.ab.cn/odata/Processes
请求头:Authorization:Bearer+空格+token
请求体:如果不做限制,则返回本用户权限范围内的所有包。
响应体:
{
"@odata.context": "",
"@odata.count": 1,
"value": [
{
"IsActive": false,
"SupportsMultipleEntryPoints": true,
"MainEntryPointPath": "001_01_KADDDeductionReport\\Fin_Commercial_OneStopShop_001_01_02_KADDDeductionReportWeekly.xaml",
"RequiresUserInteraction": true,
"IsAttended": false,
"TargetFramework": "Legacy",
"Title": "Fin_Commercial_OneStopShop_001_KADD",
"Version": "1.0.29",
"Key": "Fin_Commercial_OneStopShop_001_KADD:1.0.29",
"Description": "Fin_Commercial_OneStopShop_001_KADD",
"Published": "2022-09-06T08:29:28.9333333Z",
"IsLatestVersion": false,
"OldVersion": null,
"ReleaseNotes": null,
"Authors": "admin",
"ProjectType": "Process",
"Tags": "VisualBasic VB UiPathStudioProcess",
"IsCompiled": false,
"Id": "Fin_Commercial_OneStopShop_001_KADD",
"Arguments": {
"Input": null,
"Output": null
}
}
]
}
Folders(文件夹)
获取文件夹
方法:GET
请求地址:https://uipathoc.ab.cn/odata/Folders
请求头:Authorization:Bearer+空格+token
响应体:
{
"@odata.context": "https://uipathoc.ab.cn/odata/$metadata#Folders",
"@odata.count": 7,
"value": [ {
"Key": "9615a084-86a8-452a-8080-6d347bd60a26",
"DisplayName": "Fin_Commercial_OneStopShop",
"FullyQualifiedName": "ABI/Fin/Commercial/Fin_Commercial_OneStopShop",
"FullyQualifiedNameOrderable": "ABI�Fin�Commercial�Fin_Commercial_OneStopShop",
"Description": null,
"ProvisionType": "Automatic",
"PermissionModel": "FineGrained",
"ParentId": 24,
"ParentKey": "2cb9bb8c-daef-4f44-bc39-09537158d632",
"IsActive": true,
"FeedType": "Processes",
"Id": 88
} ]
}
Release(流程)
Release是流程,默认一个包有一个主流程,但可以设置多个入口点,包+入口点唯一确定1个流程。
【技巧】先返回所有结果集,观察键值,再通过filter找到需要触发的流程
获取多个流程
方法:GET
请求地址:https://uipathoc.ab.cn/
/odata/Releases
请求头:Authorization:Bearer+空格+token
请求体:如果不做限制,则返回本用户权限范围内的所有流程。
响应体:
OrganizationUnitFullyQualifiedName
:文件夹名
Name
:OC流程名
ProcessKey
:包名
*OrganizationUnitFullyQualifiedName
+Name
唯一确定1个流程*
{
"@odata.context": "https://uipathoc.ab.cn/odata/$metadata#Releases",
"@odata.count": 1,
"value": [{
"Key": "b76cf2e6-4724-45c3-ac57-1f9c8dca560c",
"ProcessKey": "DL_MRP_RPA_004_POCreate",
"ProcessVersion": "1.0.14",
"IsLatestVersion": false,
"IsProcessDeleted": false,
"Description": "PO Create",
"Name": "DL_MRP_RPA_004_POCreate",
"EnvironmentId": null,
"EnvironmentName": "",
"EntryPointId": 10423,
"InputArguments": null,
"ProcessType": "Process",
"SupportsMultipleEntryPoints": true,
"RequiresUserInteraction": true,
"IsAttended": false,
"IsCompiled": false,
"AutoUpdate": false,
"FeedId": "bfd8d74f-73c9-4cdb-ab50-a12c4d359e85",
"JobPriority": "Normal",
"CreationTime": "2023-01-20T05:43:27.817Z",
"OrganizationUnitId": 122,
"OrganizationUnitFullyQualifiedName": "ABI/DL/MRP/DL_MRP_RPA",
"TargetFramework": "Legacy",
"Id": 788,
"Arguments": {
"Input": "[]",
"Output": "[]"
},
"ProcessSettings": null
}]
}
获取单个流程
方法:GET
请求地址:https://uipathoc.ab.cn/odata/Releases({key})
(key为Release的id)
请求地址示例:https://uipathoc.ab.cn/odata/Releases(788)
响应体:
{
"@odata.context": "https://uipathoc.ab.cn/odata/$metadata#Releases/$entity",
"Key": "b76cf2e6-4724-45c3-ac57-1f9c8dca560c",
"ProcessKey": "DL_MRP_RPA_004_POCreate",
"ProcessVersion": "1.0.14",
"IsLatestVersion": false,
"IsProcessDeleted": false,
"Description": "PO Create",
"Name": "DL_MRP_RPA_004_POCreate",
"EnvironmentId": null,
"EnvironmentName": "",
"EntryPointId": 10423,
"InputArguments": null,
"ProcessType": "Process",
"SupportsMultipleEntryPoints": true,
"RequiresUserInteraction": true,
"IsAttended": false,
"IsCompiled": false,
"AutoUpdate": false,
"FeedId": "bfd8d74f-73c9-4cdb-ab50-a12c4d359e85",
"JobPriority": "Normal",
"CreationTime": "2023-01-20T05:43:27.817Z",
"OrganizationUnitId": 122,
"OrganizationUnitFullyQualifiedName": null,
"TargetFramework": "Legacy",
"Id": 788,
"Arguments": {
"Input": "[]",
"Output": "[]"
},
"ProcessSettings": {
"ErrorRecordingEnabled": false,
"Duration": 40,
"Frequency": 500,
"Quality": 100,
"AutoStartProcess": false,
"AlwaysRunning": false
}
}
Job(作业)
Job是作业,作业是流程的实例。
开始作业
方法:POST
请求地址:https://uipathoc.ab.cn/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs
请求头:
X-UIPATH-OrganizationUnitId
: 文件夹ID
Authorization:Bearer+空格+token
请求体(完整参数请参考Swagger页面):
ReleaseKey:Release的Key
RuntimeType:运行类型,如果设置为attended会报错。
{"startInfo": {
"ReleaseKey": "b76cf2e6-4724-45c3-ac57-1f9c8dca560c",
"JobsCount": 1,
"JobPriority": "Normal",
"Strategy": "ModernJobsCount",
"ResumeOnSameContext": false,
"RuntimeType": "Unattended"
}
}
响应体:
{
"@odata.context": "https://uipathoc.ab.cn/odata/$metadata#Jobs",
"value": [
{
"Key": "38a4b511-7d9b-4e06-aebb-86693d4af12c",
"StartTime": null,
"EndTime": null,
"State": "Pending",
"JobPriority": "Normal",
"Source": "Manual",
"SourceType": "Manual",
"BatchExecutionKey": "b8c9a01e-014b-4a83-9ea3-42f8eecbf0dc",
"Info": null,
"CreationTime": "2023-02-03T06:41:00.06Z",
"StartingScheduleId": null,
"ReleaseName": "DL_MRP_RPA_004_POCreate",
"Type": "Unattended",
"InputArguments": null,
"OutputArguments": null,
"HostMachineName": null,
"HasMediaRecorded": false,
"PersistenceId": null,
"ResumeVersion": null,
"StopStrategy": null,
"RuntimeType": "Unattended",
"RequiresUserInteraction": true,
"ReleaseVersionId": null,
"EntryPointPath": "Business\\DL_MRP_RPA_004_POCreate.xaml",
"OrganizationUnitId": 122,
"OrganizationUnitFullyQualifiedName": null,
"Reference": "",
"ProcessType": "Process",
"ProfilingOptions": null,
"ResumeOnSameContext": false,
"LocalSystemAccount": "",
"OrchestratorUserIdentity": null,
"Id": 170708
}
]
}