Blog
Read the latest blogs
Find tutorials, guides and use case examples in the
Learning centerThe 'Re-Run on Agents' endpoint re-triggers a schedule identified by the runId on the specified agents. The response is a new runId, which is a unique value for the specific run.
The initial runId is typically generated from the Run Schedule Now endpoint, which is then used to rerun the same schedule.
This endpoint can be used to run a schedule with the exact same versions of flows, sub-flows etc. as the original run, but the user has the option to choose a different agent for the execution. From a DevOps perspective, this can be used to run the exact same version of flows (test cases) against different versions of the code base, regardless of any changes made to the flows in the meantime.
http://{controllerMachine}:{controllerPort}/api/v4/run/39f2b3e3-fa24-43e7-a2d6-38815128ac6c/reRunOnAgents
A real-life example of this is to trigger a schedule with the URL of the website that the automation flow should use in the execution. Creating a URL variable in the schedule and assigning different values for the URL will trigger the flows on different websites.
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.
http://{controllerMachine}:{controllerPort}/api/v4/run/{runId}/reRunOnAgents
Property | Type | Description | Comments |
---|---|---|---|
runId | string | The runId is a unique Id for the individual run instance of a schedule | The runId can be fetched from the response body of the Run Schedule Now endpoint |
requestBody |
application/json |
Request request comprising following parameters: Variable
Steps
|
Api Rerun Options is a JSON object |
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'accessKey: Mo87Nc4qDAtzJNDb' -d '{ \
"Variables": [ \
{ \
"Name": "MyVar", \
"Value": "strTemp" \
} \
], \
"Steps": [ \
{ \
"RunListStepId": "9d9c00fe-7ced-4494-8841-308491ebc899", \
"AgentIds": [ \
"8j9c09fe-7ced-4494-8841-378491ebc556" \
], \
"EnvironmentParallelization": "runAllCases", \
"StartOrder": "defined" \
} \
] \
}' 'http://localhost:9001/api/v4/run/4d9c09fe-7ced-4494-8841-378491ebc899/reRunOnAgents'
$headers = @{}
$headers.Add("AccessKey","Mo87Nc4qDAtzJNDb")
$runID="39f2b3e3-fa24-43e7-a2d6-38815128ac6c"
$requestBody = @'
{
"Variables": [
{
"Name": "MyVar",
"Value": "strTemp"
}
],
"Steps": [
{
"RunListStepId": "9d9c00fe-7ced-4494-8841-308491ebc899",
"AgentIds": [
"8j9c09fe-7ced-4494-8841-378491ebc556"
],
"EnvironmentParallelization": "runAllCases",
"StartOrder": "defined"
}
]
}'@
Invoke-WebRequest -Uri "http://{controllerMachine}:{controllerPort}/api/v4/run/$runID/reRunOnAgents" -ContentType "application/json" -Headers $headers -Method PUT -Body $requestBody
The RunId of the run is returned in this response:
{ |
Field | Type | Description | Comments |
---|---|---|---|
runId | string | The runId is a unique Id for the individual run instance of a schedule | The runId can be used to fetch information about the execution output of flows defined in a schedule |
200 (OK)
404 (Not Found)
401 (Unauthorized)
400 (Bad Request)
405 (Method Not Allowed)
500 (Internal Server Error)
©2024, Leapwork. All rights reserved.