A Dummies Guide to Building APIs in Low-code
Learning how the low-code movement has converged with traditions of using APIs to solve business problems.
Join the DZone community and get the full member experience.Join For Free
Building an API Can Be Easy if You Have the Right Approach
Building a fully functional REST API from the ground up is a large project for any developer, and even more challenging for IT professionals unfamiliar with the nuances of how APIs are coded, deployed, and maintained. A low-code development tool can lighten your load and deal with most of the complexity for you, leaving you with only needing a basic understanding of how API’s work.
So How do API’s Work?
There are a couple of basic, but important concepts that form the basis of an understanding of APIs. To get us started, let’s look at these:
In a nutshell, it all comes together like this;
To work with (“consume”) an API, an application (also referred to as ‘client’) must send a request message that indicates what the application wants to do (e.g. GET or POST specific details) to an API endpoint. The application will be authenticated before a successful connection can be established. Once the connection is established, and the request message is processed, the application will receive a response message.
Do the Following:
Before you even start, determine why you want to integrate with the other system:
- your business requirements will determine which operations you will perform on the other system:
- you may for example want to read (GET), create (POST), update (PUT), or delete data
Most APIs have an extensive API Reference published, which you need to go through in order to use the API. Look for the API Reference and understand how the specific API handles authentication and data.
When you know why you want to integrate, and how to use the API, do this:
- by providing connection details for the API endpoint
2. Be authenticated…
- by providing your user authentication details, if required
3. Send request…
- by using a specific method, e.g. GET (to retrieve data), POST (to add or create new data), PUT (to update data), or DELETE (to delete data)
- to a specific URL and path
- by including relevant input data via e.g. Query parameters, header or body details
4. Handle response…
- by receiving the requested data, as well as success or failure responses
- by processing the response data in your application to achieve your solution’s overall goal. Tools such as Linx supports responses in both JSON and XML formats and makes it easy to handle the response data in any of the pre-packaged plugins that contain hundreds of functions, types, and services.
API Specifications: SOAP and REST
Let’s now expand on our basic understanding of endpoints, authentication, requests, and responses, by looking at API specifications.
The goal of API specifications is to standardize the exchange of data. Standardization makes it possible for diverse systems, written in different programming languages and potentially running on different operating systems, or using different technologies, to seamlessly communicate with each other.
The implication of this is that when you consume an API, the specification will determine the nature of how you will connect, authenticate, send a request, and receive a response.
Using Low-code for Your API Integrations
Low-code platforms come in all shapes and sizes for all sorts of different business types and needs. For the purpose of this example, I will use Linx, a dev tool that enables the rapid development and deployment of back-end applications like APIs, integrations and automations.
Low code development platforms take the evolution forward by adding a visual way of representing computing and/or domain concepts. They come with the underlying infrastructure to support their visual language and remove any friction between building and running the final application.
We can now create a mobile application by dragging and dropping some controls, filling in properties, and then publish it with a couple of clicks. No syntax to remember, build steps to run or servers to set up.
In Linx you can integrate API’s by using the functions of one of these plugins:
- The SOAP or REST plugins, specifically the CallSOAPWebService or CallRESTEndpoint functions. The plugins (like nuggets or NPM packages) reduce 1000s of lines of code to a single visual function with properties to guide the developer to success. They simplify the integration to specific systems, e.g. various Amazon Web Services plugins (including S3, EC2, SNS, SQS, CloudTrail), Google Drive, Google Sheets, Azure Storage, Xero, and QuickBooks.
How to Use CallSOAPWebService
You will need the details of:
- The WSDL of the Service you want to call
- The method to call in the web service
- The Service URL to use when making the SOAP call
- Authentication details
Go here for more details on the CallSOAPWebService properties and usage.
How to Use CallRESTEndpoint
You will need the details of:
- Full URL for the request
- Method type to use in the request (e.g. GET, POST, PUT, DELETE)
- Authentication details
- Request details (how to send request data and what data to send)
- Query string (parameters to send with request)
- Header details
- Body details
- Response output type
Go here for more details on CallRESTEndpoint properties and usage.
How to Use API-Specific Plugins
3rd party API’s require you to register accounts with them, set up specific app details, and create authentication or connection details for use when making a call to that API. When these prerequisite steps have been performed, using Linx to programmatically integrate to the 3rd party API becomes a breeze.
As an example, let’s look at the steps for integrating to Google Drive :
- Add the Google Drive plugin to your Solution (it’s literally a click of a button).
- From the Google Drive plugin, drag & drop your required Function (e.g. DeleteFile) onto your solution’s design canvas.
- Provide your Google API connection details.
- Set the properties for the selected Function (e.g. in the case of DeleteFile, set the FileID property).
Working with APIs is made less complicated and faster by using common programming tools that are built for increasing developer efficiency.
Watch: Build and Deploy an API in Under 10 Minutes
Published at DZone with permission of Anthony Morris. See the original article here.
Opinions expressed by DZone contributors are their own.