Orchestrator API Edit (Put) Schedule via .ProcessScheduleDto in Studio. How to DEV in Studio?

Hi,

when editing the Trigger (Schedule) via Custom API Calls in Studio and in Orchestrator (2019.10.14) with the following data:

{
      "Enabled": true,
      "Name": "R057_***_PV0000108",
      "StopStrategy": "SoftStop",
      "StopProcessExpression": "1150",
      "TimeZoneId": "Central European Standard Time"
    }

image

the following message appears to me:

Response Code 409
Response Body

{
  "message": "The name *** is already used.",
  "errorCode": 1001,
  "resourceIds": null
}

Below are my permissions from the Orchestrator


image

What is the reason for this message in Response Body? Is data not enough?

1 Like

Okay, I found the minimum data:

{
      "Enabled": false,
      "Name": "R057_***_PV0000108",
      "ReleaseId": 113,
      "StartProcessCron": "0/12 * * ? * * *",
      "StartProcessCronDetails": "{\"type\":5,\"minutely\":{},\"hourly\":{},\"daily\":{},\"weekly\":{\"weekdays\":[]},\"monthly\":{\"weekdays\":[]},\"advancedCronExpression\":\"0/12 * * ? * * *\"}",
      "StopProcessExpression": "1200",
      "StopStrategy": "SoftStop",
      "TimeZoneId": "Central European Standard Time",
      "Id": 168
    }

Response Body

no content

Response Code

204
1 Like

Hi, I have to go back to the topic again because the Trigger does not work.

After entering the following example data in SWAGGER:

  "Enabled": true,
  "Name": "R057_****_PV0000083",
  "ReleaseId": 113,
  "EnvironmentId": "18",
  "StartProcessCron": "31 37 17 20 FEB ? 2020",
  "StartProcessCronDetails": "{\"type\":5,\"advancedCronExpression\":\"31 37 17 20 FEB ? 2020\"}",
  "StartStrategy": 0,
  "ExecutorRobots": [
{
  "MachineName": "PVxxx"
}
  ],
  "StopProcessExpression": "10000",
  "StopStrategy": "SoftStop",
  "TimeZoneId": "Central European Standard Time",
  "TimeZoneIana": "Europe/Warsaw",
  "UseCalendar": false,
  "MaxJobsForActivation": 1,
  "Id": 170
}

I have the following answer from the server
Response Body

  •  "message": "An error has occurred.",
     "errorCode": 0,
     "resourceIds": null```
    
    

Response Code

  • 500

When I send the same query with the function: "Enabled": false

Response Body

  • no content

Response Code

  • 204

The trigger will update with new data, but none of the Robots is selected.
The view shows 0 selected rows:

IMPORTANT: I note that before editing this Trigger the robot position is marked.

The above situation also happens when I enter the same data set, but I do not declare a Robot (i.e. I want to change only a part of the data, i.e. CRON), and yet the Robot list is cleared everytime.

I also checked the above for the declaration “All Robots” and “Allocate dynamically”. In each case, the same situation for the function Enabled = true the Response is 500.

What’s going on, where’s the mistake?
@loginerror @bcorrea

1 Like

I found the reason why Studio didn’t add the Robot to the Trigger.
The reason was the library and no RobotExecutorDto() reference to ProcessScheduleDto.ExecutorRobots.

It should look like this in my case:

Request = New UiPathWebApiLibrary.ProcessScheduleDto()
Request.ExecutorRobots = {robot}
robot = New UiPathWebApiLibrary.RobotExecutorDto()

image

1 Like

hi Adrian,

i tried the same way when put in the minimum require data with enabled: false, i can update with response code 204. But when change enabled: true it is error 500 response. Any idea to update the process schedule with enable is true?

hello NykieLau
I didn’t find the solution, but I did a workaround by editing the trigger with enabled: ‘false’ and with another API query (enable / disable schedule) I enable this trigger. This solution works for me so far. Unfortunately, at the moment I have no way of giving you screenshots, because I’m on vacation.

thanks for your quick response. Can’t find the api to enable the schedule. Seems UiPath did not share the details.

Can You try this query: ProcessSchedules_SetEnabled

Look at UiPath:

SetEnabledParameters = New UiPathWebApi.SetEnabledParameters
SetEnabledParameters.Enabled = Value As Boolean
SetEnabledParameters.ScheduleIds = Value As Array of System.Int64
2 Likes

i can execute the api with 200 ok response.but when check on Orchestrator the specific schedule is not enable.

How does this schedule trigger the process? How often is it triggered? Do you have CRON set up there?

I will describe how I have it set up, maybe it will help:

  1. I created a trigger in the Orchestrator with a specific name, a specific process to run, and a machine and start times in CRON.
  2. Via API I am updating the trigger to the same parameters except for the shifted CRON to start, for example in 1 minute. You can make an example start in 1 hour (remember that Orchestrator time is UTC + offset).
  3. Call the API query Set Enabled: ‘true’ for the correct scheduleID. You can test the API query via Swagger and see the result in the Orchestrator).
  4. Check if the trigger in the Orchestrator is turned on.

When starting the process, the robot uses the trigger once for one machine (I have a separate trigger for each machine). Only CRON is actually changed.

1 Like

I’m using postman to test and manage to update the Process schedule as my intention is change the executor robots not schedule time. Is the uri and parameters that i used for enable schedule correct from the screenshot above?

API: https://orchestratorserver/odata/ProcessSchedules(‘Id’)/UiPath.Server.Configuration.OData.SetEnabled
json body:
{

"Enabled": true

}

I think is the json body i put is incorrect. Now is work with following require parameters:
{

“scheduleIds”: [

Id

],

“enabled”: true

}

Many thanks for your sharing @Adrian_Star !!

In my organization, access to the use of external programs is blocked, so I do not use Postman. I use Swagger and Custom API library for this. I don’t want to mess with your work organization, but you can check what your request looks like in Swagger - if it works in Swagger, then Postman will be OK.

Great! :slight_smile:

I do not seem to be able to select a robot when I try to set a trigger. How can I get a check in the box in front of robot?

Can you give more details about the Orchestrator? What version is this, and it’s Cloud or Server?

I see you have 1 machine in the environment. You can use the option in API call:

"StartStrategy": 1,

which dynamically assigns the robot to job.
image

Start Stretegy worked, great! But if I were to select a specific robot, how would I do that? I am momentarily working on a cloud orchestrator version 2020. But I am acutally trying to simulate a call I need for work where we work with an on premise orchestrator. At work we have several robots and it is important to select a specific one…

Attached you find my JSON call

I had a similar problem when enabling the triggers.
To solve the problem, you need to see the data that the query model handles.
It will be best for you to trigger robots by their ID.

RobotExecutorDto {Id (integer, optional)}

as you can see, it needs Integer value, but when building the solution I know that this value is System.Nullable <System.Int64>. We can pass the Long value.

To get the Robot ID use:

GET / odata / Robots

I checked the query in the swagger and I can only indicate 1 robot by:

PUT / odata / ProcessSchedules({Id})

If this helps you, the part responsible for pointing the robot and mimimum set of data:

{
"Enabled": false,
"Name": "fake_trigger",
"ReleaseId": 174,
"EnvironmentId": "34",
"StartProcessCron": "0 0 0 ? 1/3 MON *",
"StartProcessCronDetails": "{\"type\":4,\"minutely\":{},\"hourly\":{},\"daily\":{},\"weekly\":{\"weekdays\":[]},\"monthly\":{\"weekdays\":[{\"id\":\"MON\",\"weekly\":\"Monday\",\"monthly\":\"Monday\"}],\"atMinute\":0,\"atHour\":0,\"frequencyInMonths\":\"3\"},\"advancedCronExpression\":\"\"}",
"StartProcessCronSummary": "At 12:00 AM, only on Monday, every 3 months",
"StartStrategy": 0,
"ExecutorRobots": [
{
"Id": 10
}
],
"TimeZoneId": "Central European Standard Time",
"TimeZoneIana": "Europe/Warsaw",
"Id": 399
}

Response Body

no content

Response Code

204

Look at UiPath:

It works now. Thank you very much for your help! :slightly_smiling_face:

1 Like

Happy API automation! :slight_smile: