Skip to content

Finish Run

The Finish Run endpoint is used to let Anymate know that a Run has finished. It can be used at any point to stop an ongoing run, even if you have started the run using the TakeNext endpoint.

Details

Finish Run accepts a FinishRun object:

    {
        "runId" : 75615,
        "overwriteSecondsSaved" : null,
        "overwriteEntries" : null
    }
  • RunId: Required - Will tell Anymate which Run to finish. Without it, it will not work.
  • overwriteSecondsSaved: optional - Overwrites the Seconds Saved settings when logging KPI's for this run
  • overwriteEntries: optional - Overwrites the Entries settings when logging KPI's for this run

Finding the RunId

The RunId is found in the response from StartRun or included with any task from TakeNext.

overwriteSecondsSaved and overwriteEntries is used to overwrite KPI's on the Run. It is the most common scenario that these are not included (undefined) or left as null. It typically only for advanced Mates where KPI's are followed more closely that these become relevant. If overwriteEntries is filled out, and overwriteSecondsSaved is left as null then Anymate will update the KPI's using the default settings for seconds saved pr. entry. If overwriteSecondsSaved is filled out, then that will be the value logged in the KPI's regardless of what overwriteEntries are (however amount of entries is always logged so it can still be relevant later when doing data analysis on the Mates performance). Click [here][processkpi] to learn more about KPI's. If tasks are enabled, then KPI's will be registered per Task and not for the Run.

Example

The endpoint is found at https://{ClientId}.anymate.app/api/FinishRun/ The http-request must be submitted as a POST with JSON encoded data.

curl --request POST \
        --url https://{ClientId}.anymate.app/api/CreateTask/{ProcessKey} \
        --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjgyQ0JGNDY3NEMyMUExRjBCMjhFNzlBNTk5MzAwQjdBIiwid.....' \
        --header 'Content-Type: application/json' \
        --data '{
                    "runId": 1
                }'

Using the Anymate .NET SDK, use the FinishRun method on IAnymateService to finish a run.

using Anymate;

//Code omitted

//Initialize AnymateService
var anymateService = new AnymateService(client_id, client_secret, username, password);

// code omitted where run was started and businesslogic performed.

//Get the runId from when the run was started
long runId = startRunResponse.RunId;

//With runId as input, we can now finish the run.
var finishRunResponse = anymateService.FinishRun(runId);

//Code omitted

KPI overrides are optional

It is optional to assign KPI overrides. In the Finish and Reporting section, defaults are configured that will be used if overwriteEntries and/or overwriteSecondsSaved is left blank.

Using the Anymate Python SDK, simply invoke the finish_run function in the anymate.client class.

import anymate

# code omitted

# Initialize the client
client = anymate.client(client_id, api_secret, username, password)

# Start the run
start_run_response = client.start_or_get_run(myProcessKey)

# Read run_id from StartRun Response
run_id = start_run_response.runId

# Code omitted where work is being performed

# Finish the run
finish_run_response = client.finish_run({'runId': run_id})

The finish_run function takes a object or a dictionarty as input.

KPI overrides are optional

It is optional to assign KPI overrides. In the Finish and Reporting section, defaults are configured that will be used if overwriteEntries and/or overwriteSecondsSaved is left blank.

Using the Anymate UiPath SDK, simply invoke the Finish Run activity.

Finish Run alt >

In the example, code is omitted where the variables are assigned.

KPI overrides are optional

It is optional to assign KPI overrides. In the Finish and Reporting section, defaults are configured that will be used if overwriteEntries and/or overwriteSecondsSaved is left blank.