Run Schedule Now

Description

This endpoint triggers a schedule identified by the scheduleId. The response is a runId, which is a unique value for the specific run of the triggered schedule. 

This endpoint is used a lot for integration with Continuous integration (CI) system to trigger collections of automation cases as part of a greater release plan. 

In the configuration of a schedule using LEAPWORK Studio, it is possible to define variables and assign values to the variables. It is also possible to set the values of the variables using this endpoint, by adding the name of the variable and the value as GET parameters in the calling URL.

Examples

http://{controllerMachine}:{controllerPort}/api/v3/schedules/39f2b3e3-fa24-43e7-a2d6-38815128ac6c/runNow?var1=val1&var2=val2   

In this example the value of ‘var1’ and ‘var2’ will be set to ‘val1’ and ‘val2’ respectively, if the variables are defined in the schedule configuration. The schedule variables can be used dynamically in the automation flows, so this is a method to input values and parameters directly to the individual automation flows via the schedule.

A real-life example of this is to trigger a schedule with the URL of the web site, that the automation flow should use in the execution. Creating a URL variable in the schedule and assign different values for the URL will trigger the flows on different web sites.

To understand more about using scheduled variables, please see this blog post: https://www.leapwork.com/services/learning-center/running-same-test-case-in-multiple-environments.

Request URL

http://{controllerMachine}:{controllerPort}/api/v3/schedules/{scheduleId}/runNow

Input parameters

Property Type Description Comments
scheduleId string Unique identifier for a Schedule scheduleId can be fetched from response body of Get Schedule

Examples

Curl

curl -X PUT --header 'Accept: application/json' --header 'AccessKey: Mo87Nc4qDAtzJNDb' 'http:// {controllerMachine}:{controllerPort} /api/v3/schedules/39f2b3e3-fa24-43e7-a2d6-38815128ac6c/runNow'

PowerShell 

$headers = @{}

$headers.Add("AccessKey","Mo87Nc4qDAtzJNDb")

$ScheduleID="39f2b3e3-fa24-43e7-a2d6-38815128ac6c"

Invoke-WebRequest -Uri "http://{controllerMachine}:{controllerPort}/api/v3/schedules/$ScheduleID/runNow" -ContentType "application/json" -Headers $headers -Method PUT 

Response

RunId of schedule is returned in response.

{
"$id": "1",
"RunId": "da6845c9-ae69-45d3-b100-795a3b866623"
}

 

Response object

Field Type Description Comments
runId string The runId is a unique Id for the individual run instance of a schedule runId can be used to fetch information about execution output of flows defined in a schedule.

Response Code

200 (OK)

404 (Not Found)

401 (Unauthorized)

400 (Bad Request)

405 (Method Not Allowed)

500 (Internal Server Error)