HTTP Request to API Orchestratror via Angular JS

Hi there,

I’m trying to start my robots from my own browser using AngularJS (just playing a bit with UiPath Orchestrator API).

I’m able to get all the info I need to start a Job via https://platform.uipath.com/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs and I try to pass all of it like so:

var infoJob = {
				ReleaseKey : releaseKey,
				RobotIds : robotId,
				NoOfRobots: 0,
				Strategy: 'Specific'
			};

			var startJobInformation = {
				startInfo : infoJob
			};
			
			startJobInformation = JSON.stringify(startJobInformation);
			
			var startJob = {
				method: 'POST',
				url: "https://platform.uipath.com/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs",
				headers: {
					'Content-Type' : 'application/json',
					'Authorization': token
				},
				data: startJobInformation
				}
				
			$http(startJob).then(function (responseStart){
				console.log("Starting Job");
			});

The problem is, that even passing all the startInfo as body I receive this error message: {“message”:“startJobParameters is null!”,“errorCode”:0,“resourceIds”:null}

Any idea of what I’m missing?

Regards,
Andrei

1 Like

The only thing I see is that RobotIds is supposed to be an array…

Try to get valid response using swagger, fiddler or postman.
Your angular code to make the call is correct.

I’ve changed it to an array (I though I’ve already tried that before) and is working fine now. Thanks for your help

do you have a step by step on how to trigger the job in a browser?

im new in API so sample will be much appreciated.

thanks in advance!

I’ve created a simple html page and with AngularJS I do http request to Orchestrators API.

The steps that must be followed to finally execute the jobs are:

  1. Authenticate in Orchestrator via API Authentication. You will need to pass the token through all the next steps.

  2. Get the information you need of the robots, processes and releases (look into the API Guide). You will need the release key to identify a unique process

  3. Execute the job by calling to StartJobs as in the example you can see in this post.

Basically it’s everything you need to know :wink:

2 Likes

great! you are awesome! thanks.

Just remember that you need to use an array for robotsIds

var infoJob = {
     ReleaseKey : releaseKey,
     RobotIds : [robotId],
     NoOfRobots: 0,
     Strategy: ‘Specific’
};
1 Like

Hi Andrei_Preda

I also think that run “StartJobs” via API, and your way seems so smart!

Now I am able to run “StartJobs” from Orchestrator swagger,
but I am struggling with making html file with AngularJS .

If it is not inconvenient to you, Could you share html sample?

Hi,

This is how I managed to execute jobs from a browser using AngularJS.

My knowledge of AngularJS is vey basic, so probably you can improve it a lot. Take a look into the code, because I’ve added <> where you will need to use your own data, like tenant Name, email, etc.

Test.html (2.6 KB)

4 Likes

I appreciate your support!