HTTP Request to API Orchestratror via Angular JS

uiautomation
orchestrator
activities

#1

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


Start jobs via API
#2

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


#3

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


#4

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


#5

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!


#6

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:


#7

great! you are awesome! thanks.


#8

Just remember that you need to use an array for robotsIds

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