Running a process on UI path cloud from a python script which triggers the flow on desktop

My target is to use python script to invoke a flow that I have saved on UI Path cloud that I have published through UI Path assistant. I can get the bearer token and process ID through the code but while trying to obtain the robot ID I’m getting the following error
“‘message’: ‘An organization unit is required for this action.’, ‘errorCode’: 1101, ‘traceId’: ‘00-5288519350d94e5d8d48cc19d774b984-7e9043bf6e28b156-00’, ‘resourceIds’: None”.
I have created my process in a new folder and using this code to get the robot ID
def getRobotID(robotName):
robot_name = requests.get(f"https://platform.uipath.com/{account_name}/{tenant name}/odata/Robots?$filter=Name%20eq%20’{robotName}’",
headers={“Authorization”: “Token”,
“X-UIPATH-TenantName”: “Account name”,
“X-UIPATH-OrganizationUnitId”: “Workspace”,
“Content-Type”: “application/json”})
robot_json_obj = json.loads(robot_name.text)
print(robot_json_obj)
robotID = robot_json_obj[“value”][0][“Id”]
print(robotID)

1 Like

Hey @nitesh.chouhan24

The organization unit ID header you are passing should be numeric… You can find it from your URL fid after you navigate to that particular folder.

Thanks
#nK

1 Like

Yes after passing the numeric organization unit ID Im still getting 0 robots

1 Like

Hey @nitesh.chouhan24

Is the robot I’d you are passing is right ?

Thanks
#nK

In cell 47 if you see, I’m not passing any name for robot as I want to get the details of all the available robots.
in Headers im passsing the bearer token and the folder ID.

1 Like

Version of orchestrator, please ?

Thanks
#nK

Company Policy: None

Widgets:
UiPath.Marketplace.Widget@1.1.1
UiPath.Apps.Widget@1.0.6

UiPath Assistant 21.10.4+Branch.master.Sha.d2e8b8c43460e3a32b72e2933b4ceccf02e3ad51
Microsoft Windows 11 Enterprise 10.0.22000 (ia32)

1 Like

Hey @nitesh.chouhan24

Sorry, just thought. I think now since everything has been moved to users modules as it is all modern folders.

Try using the Users endpoint for getting the same.

Thanks
#nK

Thanks for looking out @Nithinkrishna , I’m exploring all possible obtions to run a job from python code. I appreciate your support.

  • Nitesh
1 Like