Connect to any REST service without writing code and develop your apps faster with the new REST integration in Progress Rollbase.
In today’s world, most of the service providers provide APIs to access their services through RESTful web services. RESTful web services are lightweight, highly scalable and very commonly used to create APIs for web based applications. In this blog, you will learn how to connect such external REST services to Rollbase.
We've added a new trigger type called REST service to enable REST integration with Rollbase. This feature enables access to REST end points without coding. Using a mapping tool, a user can associate fields from Rollbase objects to REST service requests (request parameter and request body) and map response fields to fields of Rollbase objects.The tool will auto-generate JavaScript code so that you can make an integration in a few minutes. You can connect to any JSON REST service by using this feature. It supports the following HTTP methods:
This feature also supports Basic Authentication.
Only administrators or equal admin privileged user can create a REST service type trigger.
Follow the below steps to create a new REST service trigger that integrates a REST endpoint to a Rollbase set of objects.
From the object definition page, click “New Trigger button” and select type as “REST service” from the next screen.
Name your trigger and trigger timing option, and then select Rest Service Configuration section (see screenshot below).
Enter your REST endpoint static URL Path, select your HTTP method. By default, Authorization is selected as “No Auth,” when you select Authorization as “Basic Auth” you need to provide details of Username and Password. Once you complete these details click on the Configure button which leads you to specify different metadata based on the HTTP method you selected.
For GET you can configure HTTP headers, URL Path & URL Parameters. For POST & PUT you can configure HTTP headers, URL Path & Request data as body JSON.
All these can be configured to either use data from a Rollbase record or to be constant values.
From mapper screen, you can create mapping fields or constant fields.
After adding mapping pairs, if one would like to edit/delete them that can be done by hovering on rows and clicking the edit and delete button. The user can also sort the order of mappings by drag and drop.
After you configure all required configurations, click on the Response tab or click “Configure Response” button. This will show the response tab, from which you can make a test connection to your REST endpoint and get a sample response to build a Response tree. Alternatively, you can build the response tree by copying the JSON response from the service into the text input. The response tree is required only if REST field values must be updated on the Rollbase side, otherwise you can simply ignore this Response Tree mapping (say for POST and PUT user can simply ignore any update to Rollbase field since most of the time POST and PUT will be an update at REST side). After the tree is built the user can add/delete/edit more nodes to Response right tree by using toolbar buttons.
From Response Tree, the user can map fields from REST service fields to Rollbase fields. If the user maps REST field to Rollbase Base object fields, then we update the Rollbase field value. If the user maps REST fields to Rollbase Related object fields, then we give the user three options:
Say the user would like to get a weather report for next 7 days from a REST service for a different Progress office. In Rollbase, create a "Building" object to denote a different Progress office across the country, create another object called "Day Wise Weather" and add a relationship with "Building" object.
Create a new "REST Serive" trigger, provide the URL and add a Query parameter to pass Progress office CityId and API key as mentioned above in the Request mapping section.
The next step will be building a sample Response tree by invoking a REST endpoint as mentioned above. Now you can map fields from Response Tree to Rollbase related fields. You will be asked the three options mentioned above. Then choose Add as new record.
Once Response mapping is done, click on the “OK” button to generate trigger code.
At this stage, without any coding you have a fully working call to an external REST service.
We recognize there are times when you would want to customize the processing of the service request or of the response. You can do that very simply with a little bit of JS code. We will go over how this works in the next section.
There will be two sections of code that get auto generated. Non-editable auto generated code and customizable callback methods code. Non-editable JavaScript code gets generated every time you change the mappings, whereas customizable code will not be regenerated to preserve all the changes the user has done.
Rollbase auto generates code for your mappings with two sections of JavaScript code. The first section is customizable code and the second section is non-editable code. The customizable code section includes callback methods for data conversion before updating REST and Rollbase fields, and callback methods for processing Request to REST and Response from REST. The idea for customization code block is a user who has knowledge on JavaScript can play with these callback methods to control the data sent to REST and update Rollbase fields. This helps the user have full control of the execution of the trigger and overcome, if there are any, limitations that can’t be done through mapping (but we tried our best to cover most of the user’s use cases by default using our mapping tool). As a Low-Code platform, Rollbase provides more flexibility to the user to add more logic along with the default one that can be achieved by using custom code section.
Rollbase enables users to connect any REST service without writing much code. The user doesn’t need to have any programming skill to connect to the REST service, and they can use a simple mapping tool to connect Rollbase and REST fields. This helps the user to build complex business application very quickly. Refer to the Rollbase documentation for more details.
New to Rollbase and want to try it out? You can sign up for a free trial here.
Vimalkumar is a Senior Software Engineer at Progress. He's worked intensively on different UI technologies such as Angular JS, JQuery, Bootstrap, Kendo UI, Ext.JS , HTML5, CSS3 and Javascript for more than 4.5 years, and has 7 years of overall experience in software development. He previously worked on various Progress Cloud product UI development (Data Direct Cloud and Easyl) and is currently working on Rollbase UI development.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites