Bot trigger from python code

Failed to trigger bot. Status Code: 400
Response: {“message”:“An organization unit is required for this action.”,“errorCode”:1101,“traceId”:“00-79b191f81fef66e7a317d8cb14fd4351-71baebacfc5a18f8-00”}

Even after providing “OrganizationUnitId”: 580xxxx in payload I am getting this error. Please give solution to the same.

payload = {
“startInfo”: {
“ReleaseKey”: release_key,
“Strategy”: “Specific”,
“RobotIds”: [3989xxxxx],
“NoOfRobots”: 1,
“OrganizationUnitId”: 580xxxx,
“InputArguments”: json.dumps({
“meetingDetails”: meeting_details
})
}
}

Hi @Parth_Belsare

To fix it the quickest, I think you will just have to check the requests made by Orchestrator UI in the Network tab of your browser console.

If I recall correctly, this is because the Organization Id should be a header value. A quick look at any request made by Orchestrator in the browser should quickly clear it up for you :slight_smile:

orchestrator_url = “https://cloud.uipath.com/parthbelsare/DefaultTenant/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs

This is the url I have entered in python code to trigger the bot. Should I change this?

@Parth_Belsare

the url is correct but the org id should be present in header and not payload

image

Also better to first do a call from swagger or postman to know the correct details

<OrchURL>/swagger/index.html

cheers