Skip to content

Start Run

The Start Run endpoint is used to let Anymate know that a Mate has started working on a Process.

Start Run is not necessary on Task-enabled Processes

Take Next will automatically either start a new run or resume an ongoing run until there is no more tasks. Once the queue is empty, it will also automatically finish the run.

Details

If Start Run is called while a run is already ongoing, then it will simply resume the run and return the RunId. You can't accidently start two or more runs on the same Process at the same time. For example, we often see that it can be beneficial if an exception happen in a UiPath robot to close down all applications, reset everything and start up a fresh environment. In this case, we don't want you to worry about calling StartRun/FinishRun correctly - we take care of it.

Anymate will always respect StartRun being called, believing that the Developer knows best. StartRun thus ignores if the process is stopped or the date is blocked in the Calendar - if you call StartRun, we start a new run.

StartRun returns a json object with a RunId. Save the RunId when you later want to call FinishRun.

    {
        "processKey" : null,
        "runId" : 5568
    }

The ProcessKey is also included in the object to confirm which Process the run was started on.

Example

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

curl --request GET \
        --url https://{ClientId}.anymate.app/api/StartRun/{ProcessKey} \
        --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjgyQ0JGNDY3NEMyMUExRjBCMjhFNzlBNTk5MzAwQjdBIiwid.....' 

ClientId and ProcessKey

If you don't remember what your client Id is, you can find it here. You can see where to find the ProcessKey and more information on Developer help here

Using the Anymate .NET SDK, use the StartOrGetRun method on IAnymateService to start a run or resume a run if one is already in progress.

using Anymate;

//Code omitted

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

//Start or Resume a Run using processKey as input.
var startRunResponse = anymateService.StartOrGetRun(processKey);

//Get the runId from the response
long runId = startRunResponse.RunId;

//Code omitted

Using the Anymate Python SDK, simply invoke the 'start_or_get_run' function on the anymate.client class.

import anymate

# code omitted

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

# Check if the script should start work
is_ok_to_run = client.OkToRun(myProcessKey)

if not is_ok_to_run.okToRun:
    # If there is nothing to do, then stop the script here
    return

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

# Read run_id from StartRun Response
run_id = start_run_response.runId

start_or_get_run takes a ProcessKey string as input. The function returns a StartRun object.

Using the Anymate UiPath SDK, simply invoke the Start Or Get Run activity. Start Or Get Run returns a int64 `runId´.

Start Run alt >

Save the runId in the correct scope

Make sure to save the runId in a scope where you can reach it when you want to finish the run later.