Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert

This blog post explains  "How to integrate CAI and SAP  IRPA  by creating an API trigger and testing the scenario in Postman" and is a submission for the SAP Intelligent RPA Tutorial Challenge

I have taken a sample example of calling an open web service that takes the city as an input parameter and returns the weather condition.

Steps to be followed:

1. Create a project and workflow.

2. Create input and output parameters in the context of your scenario.

3. Create a workflow to consume that web service.

4. Deploy your project in CF.

5. Make the scenario as a skill to expose the input and output parameters.

6. Create an API Trigger.

7.Test in postman before integrating to CAI.

1. Create a project and workflow.

Project name: CAI_RPA_API.

Workflow Name:scWebServiceCall

Scenario Name:scWebServiceCall

2. Create input and output parameters in the context of your scenario.

Create the item names are q and APPID only since they are the names of the parameters.

3. Create a Workflow as shown below.


After successful registration to open web service call, APPID needs to be requested.Code for the Web service call.
GLOBAL.step({ Call_a_web_service: function(ev, sc, st) {
var rootData =;
ctx.workflow('scWebServiceCall', 'ddb02102-30f1-4141-bc4f-94263b1443ee') ;
var urlBis = ''+rootData.myData.wsParam.q +"&appid=" + rootData.myData.wsParam.APPID;
ctx.log(' urlBis : ' + urlBis);{
url: urlBis,
method: e.ajax.method.get,
data: "",
contentType: e.ajax.content.json,
success: function(res, status, xhr) {
sc.localData.output = res;
rootData.myData.wsOutput.weatherResult =[0].description;
ctx.log(' success : ' +[0].description);
ctx.log(' success from wsoutput : ' + rootData.myData.wsOutput.weatherResult);
sc.endStep(); // Write_log
error: function(res) {
ctx.log(' error: ' + res);


Build the project .

4. Deploy the project in Cloud Factory.

Refer to the below link to deploy the project in the Cloud factory.

5. Navigate to Cloud Studio and mark your scenario as a skill

to expose the input and output parameters.

6. Create an API trigger after the successful deployment of the package.A pop up appears to enter the name of the API trigger and the scenario name.Click on Create.Click on Copy and the API trigger is created successfully.

Enable the package to test the API trigger.7.Test API Trigger in POSTMAN.

Ask your administrator to provide the following information

  • Client ID.

  • Client credentials.Access Token URL: Authentication URL + /oauth/token at the end.

Create a POST request in POSTMAN with the below mapping.

Go to the authentication tab, select OAuth 2.0.

Click “Get New Access Token” and enter the information from the first point (Client ID, Client Credentials and Access Token URL) in the dialog.

You need to add /oauth/token at the end of the Access Token URL.

Click on Use Token. This token is used to access the API trigger.

Once the Use token is clicked an extra value called authorization is added to the header.Enter the body of the request as below.

Enter the value for the input parameters . Click on Send to get the output.

The output triggers the running instance  in the Cloud factory.

Open the Desktop Agent to run the project in unattended mode.The output of the API trigger can be seen in JOBS after successful execution.


The API trigger is tested and works perfectly from POSTMAN.

The endpoint URL is ready and can be consumed in any integration scenario like CAI etc.