Author: Sri Lakshmi Prabha
New to MuleSoft RPA Builder? Learn how to make API calls using REST Call. This post explains the steps using the Salesforce API as an example.
- Basic knowledge of MuleSoft RPA Builder and REST API.
What is a REST Call?
REST Call is an Action Step in MuleSoft RPA Builder. It allows fetching data directly from a server. Define the endpoint and assign parameters or process variables to the call.
How to configure proxy settings for REST Call?
Open Settings from the Workflow Initialization block. Configure proxy settings in the Network Settings tab. The REST Call Action Step retrieves necessary information automatically.
Example of using REST Call with Salesforce API
Interact with a Salesforce org using the Salesforce API. Use a resource URI such as: https://yourInstance.salesforce.com/services/data/v56.0/sobjects/opportunity
How to choose method type and authentication header?
Choose the method type for the REST call. Available values: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.
Choose authentication header type. Available values: NoAuth, ApiKey, BearerToken, BasicAuth.
API calls using BearerToken authentication
Obtain an access token from Salesforce by making a POST request to https://login.salesforce.com/services/oauth2/token and providing the necessary parameters in the query parameters.
Choose parsing method and request body type
Choose between JsonPath and XPath to extract exact information without special scripting. And for the request body type of the REST call result, choose between Json and Form URL encoded.
JSON path expression
Use a JSON path expression to specify the property of the response object to extract.
Example: To extract the access token from the Salesforce API response object, use $.access_token as the JSON path expression.
Provide the required information via the Request Body, Header Parameter, Query Parameter, and Authentication tabs. View the returned body in the text results and specify the result using JsonPath or XPath in the parsed results.
Map variables in REST Call to create a dynamic JSON body
Map variables in the REST Call to create a dynamic JSON body and assign parameters or process variables. Provide the required information in the Request Body tab by defining the JSON body and mapping variables to fields.
In conclusion, REST Call in MuleSoft RPA Builder is a powerful and flexible tool for making API calls and interacting with REST interfaces. This post demonstrated an example of using the Salesforce API with REST Call, but any API that supports RESTful calls can be used with this tool.