Unable to start a job using orchestrator API via restsharp

Hi community,

I am trying to start a job using the restsharp with the code as below.

client = new RestClient(“https://platform.uipath.com/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs”);
request = new RestRequest(Method.POST);
request.AddHeader(“cache-control”, “no-cache”);
request.AddHeader(“content-type”, “application/json”);
request.AddHeader(“Authorization”, ""Bearer " + auth + “"”);
request.AddParameter(“value”, “{\n "startInfo":\n {\n "ReleaseKey":"779b788f-07a5-4949-9a98-0200bf135acf",\n"RobotIds":[137032],\n"NoOfRobots":0,\n"Strategy":"Specific", "Source":"Manual" \n}\n}”);
response = client.Execute(request);

I get errorcode = unknownError. Below is the snap of response that i am getting.

Also I see that no job is Run. I am stuck here.

Please suggest whats the required change that i need to make.

@aksh1yadav @ovi @badita . Need help on this as soon as possible as i am stuck…

I have got the issue. It is with the authorization token that I am adding in the header. It should be

request.AddHeader(“Authorization”, "Bearer " + auth);

instead of

request.AddHeader(“Authorization”, ““Bearer " + auth + “””);

Content in the header need not be quoted.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.