How to create a process via API in uipath

Hello,

How to create a process via API in uipath using /odata/Releases using Swagger.

I tried but getting confused with all the parameters:

{
“Key”: “string”,
“ProcessKey”: “string”,
“ProcessVersion”: “string”,
“IsLatestVersion”: true,
“IsProcessDeleted”: true,
“Description”: “string”,
“Name”: “string”,
“EnvironmentId”: 0,
“EnvironmentName”: “sumit_workspace”,
“Environment”: {
“Name”: “sumit_workspace”,
“Description”: “string”,

    "RobotEnvironments": "string",
    "ExecutionSettings": {},
    "IsExternalLicensed": true,
    "LimitConcurrentExecution": true,
    "LastModificationTime": "2022-09-17T12:35:52.007Z",
    "LastModifierUserId": 0,
    "CreationTime": "2022-09-17T12:35:52.007Z",
    "CreatorUserId": 0,
    "Id": 0
  }
],
"Type": "Dev",
"Id": 0

},
“Id”: 0
},
“InputArguments”: “string”,
“ProcessType”: “Undefined”,
“SupportsMultipleEntryPoints”: true,
“RequiresUserInteraction”: true,
“IsAttended”: true,
“IsCompiled”: true,
“ReleaseVersions”: [
{
“ReleaseId”: 0,
“VersionNumber”: “1.0.2”,
“CreationTime”: “2022-09-17T12:35:52.007Z”,
“ReleaseName”: “TestSumit”,
“Id”: 0
}
],
“AllowLiveStreaming”: true,
“AllowRemoteControl”: true,
“LastModificationTime”: “2022-09-17T12:35:52.007Z”,
“LastModifierUserId”: 0,
“CreationTime”: “2022-09-17T12:35:52.007Z”,
“CreatorUserId”: 0,
“Id”: 0
}

After you published the process via command line/using the UiPath Studio publish, you may follow the below example to create a process in a specific folder:

URL: https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/Releases
Method: POST
Authorization: Bearer token

Header:
x-uipath-organizationunitid: FOLDER_ID
Accept: application/json
Content-Type: application/json

Body of type JSON:

{
  "Name": "Add process example",
  "Description": "Blank Process",
  "ProcessKey": "BlankProcess8",
  "ProcessVersion": "1.0.2",
  "EntryPointId": 889498,
  "InputArguments": "{}",
  "SpecificPriorityValue": 45,
  "JobPriority": null,
  "RobotSize": null,
  "ResourceOverwrites": [],
  "Tags": [],
  "ProcessSettings": {
    "ErrorRecordingEnabled": false,
    "Duration": 40,
    "Frequency": 500,
    "Quality": 100,
    "AutoStartProcess": false,
    "AlwaysRunning": false
  }
}

Hi,

Thanks for the response. Question:

how did you get

“ProcessKey”: “BlankProcess8”,
“EntryPointId”: 889498,

You can use your Swagger documentation to find more details:

https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/swagger/index.html#/Releases/Releases_Get

The below request returns a collection of all available versions of a given process.

GET for

https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/Processes/UiPath.Server.Configuration.OData.GetProcessVersions(processId='BlankProcess8')?$top=100&$orderby=Version%20desc

For extracting the Package Entry Points:

GET for

https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/Processes/UiPath.Server.Configuration.OData.GetPackageEntryPoints(key='BlankProcess8:1.0.2')

Hi,

How to get

x-uipath-organizationunitid: FOLDER_ID

and how to use it in the api command?

In multiple ways:

Via Orchestrator UI

Via Orchestrator UI by using the Inspect tool → Network → Headers

By a GET Rest API call for https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/Folders

Thanks for the response. Below is now what i get:

There is already a package named ‘TestSumit’ under that folder 1257444:

Now, when I am trying to create a Release out of it, it says ‘Package not found’

curl -X POST “https://cloud.uipath.com/sumitzmpfbtr/abc/orchestrator_/odata/Releases” -H “accept: application/json” -H “authorization: Bearer xxxxxx” -H “X-UIPATH-OrganizationUnitId: 1257444” -H “Content-Type: application/json;odata.metadata=minimal;odata.streaming=true” -d “{ "Name": "test", "Description": "TestSumit", "ProcessKey": "TestSumit:1.0.2", "ProcessVersion": "1.0.2", "SpecificPriorityValue": 45, "JobPriority": null, "RobotSize": null, "ResourceOverwrites": , “Tags”: }”

{“message”:“Package not found.”,“errorCode”:1677,“traceId”:“00-e782b96ba929ac4fc43aedb097d22821-c40d7aaa30a442fe-00”,“resourceIds”:null}

Not sure what I am missing here. can you help me out in this?

The easiest way for troubleshooting this by yourself is to use the Inspect tool directly from your browser. While the Inspect tool is opened, go to Network and try to create a process in the needed folder, and in the end, check the Rest API calls to see what exactly you missed.