Salesforce to ANY API ! - a REST based integration pattern
Integration is the process of bringing different systems into a communication mode and sharing the data between them. Over the years, there has been a humongous growth in the number of systems that are available, and one common mode of exposing the data to the outside world is by means of the APIs. API-led connectivity is the new go-to-thing.
With the advent of architectural styles such as REST, designing and transferring data using APIs has become comparatively an easier task, but still most of the times we start with scratch and figure out a way to design the flows for an integration.
One possible approach is using the principles of Re-usability and coming up with a generic template that could be used for most of the simple APIs. The HTTP connector available in the Mule palette itself is one such generalisation, but when it comes to Salesforce related integrations, the challenge is with the data or the field mappings. So this article is an attempt to bring out some pattern or solution that could be used by the admins with minimum confrontational changes and create a fully functional integration with any new API out there.
As shown in the below video, the integration is purely templatized and is configuration based. It works fine for Basic Authentication type APIs.
The key aspect is the Request JSON, which can be defined in a file, along with the necessary field mappings. The mule flow is designed in a way to pick the file, parse it, prepare the request body dynamically and post the request.
In case any new integration is to be done, the only changes that would be needed are the changes in Request JSON, the Property file and the user credentials. This way it reduces the efforts of the developers and greatly enables rapid development and re-usability.