No ratings

How To: Use Nintex RPA from Nintex K2 Five

 

How To: Use Nintex RPA Central from Nintex K2 Five

Introduction

This article describes how to create a REST broker service instance using example RPA Central API Swagger files to work with Nintex RPA Central from Nintex K2 Five.

Table of contents

Features

  • Work with bots, botflows and botflow instances in K2 Five. For example, start botflows, get botflow instance information, and get bot information
  • Manage RPA Central users in K2 Five. For example, get a list of users, add or delete a user, and get RPA Central information

Authentication

The RPA Central API uses Windows Integrated authentication, so be sure to use an identity that has administrative access in RPA Central. If you do not want to allow some of the actions from K2, use a designer or participant in RPA Central, depending on your scenario.

Limitations

There are two limitations when using the REST broker with the RPA Central API. These are due to K2 Five not supporting enumerations.

  1. You cannot get or set a user’s role
  2. You cannot get a botflow’s input variable type

Getting the RPA Central Swagger files to work in your K2 Five environment

Before you see SmartObjects and methods, you must do the following:

  1. Install the latest release of Nintex RPA Central and Nintex Bot from Nintex Product Releases
  2. Create one or more bots, botflows, and botflow instances. See the Nintex RPA help documentation for more information
  3. Create REST broker service instances using the example Swagger files

Operations and endpoints included in the Swagger files

RPA Central API Swagger

Action Endpoint Method type
Get a list of input variables /api/jobbotflows/{jobBotflowId}/get-input-variables GET
Run a botflow on a bot /api/jobbotflows/{jobBotflowId}/run-on-bot/{botId} POST
Run a botflow /api/jobbotflows/{jobBotflowId}/run POST
Get a JobBotflow detail by id /api/jobbotflows/{jobBotflowId}/detail GET
Get a JobBotflow by id /api/jobbotflows/{jobBotflowId} GET
Get all the JobBotflows that are not deleted /api/jobbotflows GET
Get the details for an instance by id /api/instances/{instanceId}/detail GET
Get an instance by id /api/instances/{instanceId} GET
Get a list of instances /api/instances GET
Get botflows assigned to a bot by id /api/bots/{botId}/get-jobbotflow-counts GET
Get a list of bots /api/bots GET

RPA Central Management API Swagger

Action Endpoint Method type
Get application info /api/applicationinfo GET
Get the user's information /api/users/domain/{domain}/name/{name} GET
Get the list of users /api/users GET
Get the user's information /api/users/{username} GET
Get the logged-on user's information /api/users/currentuser GET
Add a user /api/users POST
Delete a user /api/users/{userId} DELETE

Creating the REST broker service instance in K2 Five

  1. Download the attached Swagger 2.0 files
  2. Edit the file host to point to your RPA Central server, for example:
    "host": "rpacentral.yourdomain.com:8080",
  3. Add the K2 Service user as an administrator in RPA Central.
  4. Save the Swaggers and use them to register an instance of the K2 REST service for each
    • Authentication Mode: Impersonate
    • Descriptor Location: the path to your Swagger file
  5. Generate SmartObjects for each service instance

The resulting SmartObjects appear as follows:
RPAManagement1.pngRPARuntime1.png

Main SmartObjects and methods

The main SmartObjects and the methods you use to work with RPA are:
RPA Central API Swagger

  • Bot
    • GetListOfBots
    • GetBotflowsAssignedToBotById
  • Botflow
    • RunBotflow
    • RunBotflowOnBot
    • GetBotflowDetailById
    • GetBotflowById
    • GetAllBotflows
    • GetBotflowInstanceById
    • GetBotflowInstanceDetailById
    • GetListOfBotflowInstances
  • InputVariables
    • GetInputVariables

RPA Central Management API Swagger

  • User
    • GetAllUsers
    • GetCurrentUser
    • GetUserByUsername
    • GetUserByDomainAndName
    • AddUser: Requires you to serialize a UserDetail object with the user information to add
    • DeleteUser

Usage

The following RPA automation scenarios are possible by calling SmartObject methods created with Swagger.

Start a botflow

Use the RunBotflow or RunBotflowOnBot methods of the Botflow object. Returned from this method is the botflow instance ID which you can then use in the GetBotflowInstanceById method to query the status of the botflow. Note that the RPA Central API does not contain a method that allows you to pass in a callback URL for RPA Central to call when the botflow instance is completed.

Start a botflow that has inputs

Use the RunBotflow or RunBotflowOnBot methods of the Botflow object. First run the GetAllBotflows method to get the ID of the botflow you want to start, then use the ID with the GetInputVariables method of the InputVariables object. Note that you can’t get the data type of the input variables, so you’ll have to know what those are by looking at the botflow.
Pass a JSON-formatted string with the input variable names and values, such as the following:

{
         “input variable name 1”: “String Value”,
         “input variable name 2”: Number value
}

Get a list of botflow instances

Use the GetListOfBotflowInstances method of the Botflow object. Once you have the ID of a particular botflow, you can get details about a specific botflow instance.

Deserialize a botflow error

To deserialize a botflow error, use the GetListOfBotflowInstances method to get a list of all botflow instances and their IDs. Then use the ID in the GetBotflowInstanceById method to get the details including an ErrorDetail object. Take the serialized ErrorDetail object string and deserialize it using the String system type to get the actual error.
Use the GetBotflowInstanceDetailsById to return the bots assigned to that botflow.

User maintenance

Use the GetAllUsers method of the User object to get a list of current users. You can AddUser by serializing a UserDetail object and passing that as a parameter to this method. You can DeleteUser by ID.
There are a few other methods that you may want to use, but these are the main methods.

Labels: (1)
Attachments
Version history
Last update:
‎02-23-2022 02:59 AM
Updated by:
Contributors