Any complete coding examples of starting job via WebAPI in C#?

Hi All, I’m trying to kick off an Orchestrator job in C#/Visual Studio (Using RestSharp). I can’t seem to find a complete coding example of this. I can authenticate via https://[domain]/api/account/authenticate, but I think I need to get a token and pass that to OData.StartJobs endpoint, and I don’t see that in the response. There’s also a “RobotIds” param in StartJobs, which I’m not sure how to get. I did figure out how to get the release key.

Thanks for pointers to any examples.

Hi @cockcron,

After a successful auth call the API will return you response; the response body contains a field named “result” (please test this with a test app like Postman) and it will contain auth token which you will need to pass as a bearer with every subsequent API Call

As for getting RobotID
You can GET it from /odata/Robots endpoint
image

Hope that helps :)!
Best Regards,
Filip

1 Like

Thanks Filip! That’s really helpful. I’m getting close. I have the token, now getting error below (code at bottom):

“The parameter ‘ReleaseKey’ in the request payload is not a valid parameter for the operation ‘StartJobs’.”,“errorCode”:0,“resourceIds”:null}"

request.AddParameter(“Authorization”, "Bearer " + resToken, ParameterType.HttpHeader);

        request.AddParameter("startInfo", "{\n \"ReleaseKey\": \"f65f17c6-8c40-4151-baf8-1a8c3a77a5f8\",\n \"RobotIds\": \"1\",\n \"NoOfRobots\": \"0\",\n \"Strategy\": \"Specific\" \n}", ParameterType.RequestBody);

If you see anything obvious please let me know.