Overview

Sections

How to create an RPA flow to invoke an ION API endpoint

Intermediate | 25 Minutes

RPA

Overview

This tutorial will guide you through the process of creating a flow to call an ION API endpoint to retrieve a list of applications your user has access to in the Infor OS portal and write this list to an Excel file. Two flows will be created: the first flow will simply get the list and write it into an Excel file, and the second flow will iterate through the list and write each item into a separate row in an Excel file.

📋 Requirements

  • Before starting, install the latest version of RPA Studio on your machine and set up a connection between RPA Studio and RPA Management. For setup steps, refer to the Infor RPA Studio User Guide.
  • You may need to create the following artifacts for the RPA flow:
  • Create an Excel spreadsheet at the path: C:\RPA\Test.xlsx
  • Download the extended and simple list of applications from the following links:

Tutorial

1

Open RPA Studio

  • Open RPA Studio on your machine. If you are not signed in, you will be prompted to sign in before proceeding to the RPA flow designer screens.

2

Create a new project

  1. On the Home page of RPA Studio, click Create New Project and specify the following properties in the pop-up window:
  2. Name: List of Application
  3. Project Location: <default>
  4. Description: Get a list of applications your user has access to
  5. Language: VB (selected by default)

3

Add the IONAPI request activity

First, we will add the activity IONAPI Request which will allow us to call a particular API Endpoint exposed on API Gateway application part of Infor OS. The activity can be accessed in Activities panel under IONAPI category. Drag and drop the activity on the design canvas and click on it. The properties of the selected activity will appear in the properties panel. Let’s configure its properties in a following way:

  • for Method, which is the method of the API Endpoint we will be calling, select GET as the Endpoint we will be calling is of a GET method type.
  • for URL, which is the whole URL of the API Endpoint we will be using, let’s create an Argument called getapplicationlistapi of type string and default value for the Endpoint of Infor OS Suite:
  • “TenantURL+/OSPORTAL/admin/v1/user/applications” where TenantURL is your CloudSuite tenant URL which typically follows the format: “https://mingle-ionapi.inforcloudsuite.com/TENANTNAME/”
  • for Content Type, select application_json
  • File Attachment, Headers, POST Data, Query Parameters should stay empty for this particular endpoint.
  • for Response output property which will hold the API response BOD, let’s create the variable:
  • Response of type RequestObject (Infor.RPA.Utilities.ResponseObject) to find RequestObject data type expand the Variable Type and select Browse for type. In the Type name cell type RequestObject and select RequestObject under the Infor.RPA.Utilities domain.

Note: to use this activity, you should use the endpoint exposed on the tenant you are signed into as part of the RPA Studio session.

4

Optional troubleshooting with message box activity

  • To check the request body returned by the API, add a Message Box activity with the following properties:
  • Input Text: Define the VB expression _Response.ReadasJSON.tostring_ to read and convert the response body to a string.
  • Message Box Title, Button Selection, and Response Code can be left empty.

5

Assign the API response to a string variable

  • Add an Assign activity to store the API response in a String variable.
  • To: Create a variable _responseString_ of type String.
  • Value: Set to the same VB expression used in the Message Box activity: _Response.ReadasJSON.tostring_.
6

Deserialize JSON

  • Add the Deserialize JSON activity to convert the response string into a JToken Object.
  • JToken String: Set to _responseString_.
  • JToken Object: Create a variable called _JQ_ of type JToken (Newtonsoft.Json.Linq.JToken).

7

Extract application list from JSON

  • Use the JQ Transformation activity to filter the JSON response and extract the list of applications.
  • JSON Input: Create a collection with a single item, key: key1, value: _JQ_.
  • Filter: Use the payload filter .key1.applications[].name.
  • JSON Output: Create a variable called _JSONoutput_ of type JToken.

8

Optional troubleshooting with message box activity

  • For troubleshooting, you can add another Message Box activity to display the filtered values from the JSON payload.
  • Input Text: Set to _JSONoutput.tostring_.

9

Convert filtered JSON to string

  • Add an Assign activity to convert the JToken object into a String variable.
  • To: Create a variable _applicationlist_ of type String.
  • Value: Set to _JSONoutput.tostring_.

10

Write the application list to Excel

  • Add the Write Cell activity from the Excel activities category to write the application list into the Excel file.
  • Cell Address: Specify the cell address (e.g., "A1").
  • Cell Value: Set to _applicationlist_.
  • Workbook: Specify the file path C:\RPA\Test.xlsx.
  • Worksheet Name: Set to "List1".
  • The flow will write all the application names into a single cell. To split them into columns, you’ll need to first split the values and then paste them as a transposed list.


Flow Improvements

Now, improve the flow by adding activities to put each retrieved application on a separate row in a single column. Follow these steps:

1

Modify the JQ Transformation

  • After the Deserialize JSON, remove the JQ Transformation and replace it with an Assign activity.
  • To: Define the variable _JSONoutput_ (as previously created).
  • Value: Set to _JQ(“applications”).
2

Optional troubleshooting with message box

  • Leave the Message Box activity to display the JSON array of applications and additional values.
3

Remove assign and write cell activities

  • Remove the Assign and Write Cell activities, or move them as part of the While loop.

4

Add a ‘For Each’ activity

  • Add a For Each activity to count the number of objects in the retrieved array:
  • TypeArgument: Set to JToken (Newtonsoft.Json.Linq.JToken).
  • Value: Set to _JSONoutput_.

5

Add an ‘Assign’ activity to count applications

  • Inside the For Each activity, add an Assign activity:
  • To: Define the variable _count_ of type Int32.
  • Value: Set to count + 1.

6

Optional troubleshooting with ‘Message Box’

  • Add a Message Box activity to display the count of applications in the payload:
  • Input Text: Set to _count.tostring_.

7

Add a While loop

Next, we will create a While loop to help us write the values one by one until the array finished and write the values into the Excel Workbook. For that less add While activity and define:

  • Condition count > 0, it allows us to run the loop until the count is more than 0.
8

Add the sequence and JQ transformation

Next, add the Sequence, and within it, add the JQ Transformation activity to get a single application name from the payload. It will be configured in a similar way as in the first basic flow:

  • for JSON Input create a collection of a single iteam key: key1 and value: JQ

  • for Filter we need to create a JSON payload filter in order to get specific value from JSON output – the list of the application. In order to do it you should start from the JSON Input defined key1 following by payload filter which would look like: “.key1.applications[“+counter.tostring+”].name”.
  • for counter create the varibable counter of type Int32
  • +counter.tostring+ – allow us to insert the counter value so that a specific object name key value from an array is retrieved
  • Note: the Filter property data type is string so the provided filter should be within the ““ (quotation mark)
  • for JSON Output, which will store the values filtered out from JSON payload, let’s create the variable
  • called singleapplication of type JToken
9

Add Assign activity

Next add the Assign activity which would allow us to create a counter which after each interaction will be increased by 1. For that defined the following:

  • for To define counter variable
  • for Value define counter + 1

10

Add Assign activity

Next add again the Assign activity which would allow change the application variable of type JToken into string. For that defined the following:

  • for To create the variable:
  • application of type string
  • for Value define singleapplication.tostring where singleapplication is the variable output from JQ Transformation activity

11

Add Write Cell acticity

Now we can start writing the retrieved application name into Spreadsheet by adding Write Cell activity and define the following properties:

  • for Cell Address provide the exact cell address where the list of the applications can be input “A”+counter.tostring
  • Where counter.tostring is the number of the sell where we will write a single application name
  • Note: the Cell Address property data type is string so the provided cell address should be within the ““ (quotation mark)
  • for Cell Value provide the exact value(s) which should be written into it, specify application
  • for Workbook Path, which is the exact .xls file where the values will be written specify the following argument:
  • called Excel of type string and default value with .xlsx workbook created as part of the pre-requisits “C:\RPA\Test.xlsx “
  • for Worksheet Name, which is the name of the workbook within the .xlsx file, for that let’s create the argument:
  • called Workbook of type string and default value e.g. “List1
    • Note: user the exact name of the workbook of the part of the .xlsx file create, the workbook default name maybe different depending on the used language on your working station.
12

Add Assign Activity

Once the write to cell action happens we would need to decrease the count. For that let’s add Assign activity again. For that defined the following:

  • for To define count variable
  • for Value define counter – 1

Now you can test the flow and see if it allows you to write the each of the application name to a different cell and you are able to see the payloads in the Message Box.

Note: Before you publish the flow, it is recommended to remove the Message Box activities.

Activities List

Was this section helpful?

What made this section unhelpful for you?

On this page
  • How to create an RPA flow to invoke an ION API endpoint
View as Markdown

Ask an AI

Open in ChatGPTOpen in Claude