|This content applies solely to Appian RPA, which should be marked separately from the Appian low-code platform on your customer order form. Not sure if you have access to Appian RPA? Contact us to find out.
The Appian Services module extends robotic process automation capabilities within your Appian applications. Using the methods within the module, your robotic task can automatically send data to or request data from Appian numerous times throughout the task execution. These actions occur without initiating an Appian process model, making communication faster and simpler.
This module contains the service class
IAppian to define and implement calls to Appian actions. It sends the message to the Appian RPA Console, which then communicates with Appian. Using the server as an intermediary for communication between the robot and Appian bolsters security by protecting passwords and other sensitive information from being exposed on the robot.
Additionally, the module is built for ease of use between environments:
Some methods, like the uploadDocument() and downloadDocument(), can only be called from the source code. This page describes how to use methods in the Java module. See the low-code Appian Services module page for guidance in an easier and more robust development experience.
You can call the Appian Services module from the robotic task code to perform actions such as querying data, calling a smart service, and calling a Web API in Appian. The Web API method includes helpers that make it simpler to perform common actions like upload or download a document from Appian.
Unlike other Appian RPA modules, you don't need to include a Maven dependency in the
pom.xml. The Appian Services module is configured to use in robotic tasks out-of-the-box.
Use the IWebApiRequestBuilderFactory API class within the Appian Services module to call Web APIs in Appian.
The class references the environment's base URL in requests so you simply need to include the API endpoint instead of the full URL. You won't need to update the endpoint URL or Appian environment when deploying the robotic task elsewhere. However, if you update the endpoint in the Appian design object, remember to update the endpoint value here as well.
For security reasons, the API call originates from the RPA server, not the robot itself. This protects access tokens from being exposed during the request communication.
To get started, you'll first have to create the Web API object in your Appian application to properly receive and parse the data. You can configure the API response to return the data you're interested in. You can also set up the Web API to execute a smart service.
Find more details about the Web API class and associated functions in the Appian RPA Javadocs. In the console, click Help > Javadocs.
Two common uses for calling a Web API in Appian are to upload or download documents. There are two methods that can help you implement those calls faster:
Use the uploadDocument() method to upload a document in a robotic task:
IWebApiRequestBuilderFactory uploadDocument(endpoint, file, destFileName)
|API object endpoint
|File to upload. You can pass the file as an input stream from the file path so the Web API can reference the file wherever it is currently stored.
|File name to use when upload is complete. If empty, the value will be taken from the
Use downloadDocument() method to retrieve a document from Appian. To retrieve the correct document, include the document ID in the following function:
IWebApiRequestBuilderFactory downloadDocument(endpoint, documentId)
|the API object endpoint
|ID of the Appian document to retrieve
Although it is recommended to call robotic task variables from the low-code modules in your robotic task definition, you can also call them using the Java method getWorkflowVariables() in the server function. This method allows you to capture and use the variable in other points of the robotic task.
The code snippet below is an example of using the server.getWorkflowVariables() function:
// Gets the map of workflow variables containing those defined into the robot configuration page
Map<String, IRobotVariable> variables = server.getWorkflowVariables();
// Gets the variable called "var1"
IRobotVariable rv = variables.get("var1");
// Updates the value of var1 to the current value of item
Appian Services Java Module