How to Build a REST API in low-code [a step-by-step guide]

REST APIs are pretty much everywhere. They are the standard method to expose databases to clients and knowing how to develop a REST API is a necessity at all layers of the stack.

By using one of the many public APIs out there, you can expand the functionality of your application or enrich it with the necessary data.

But what if you have created your own unique functionality that you want to share with the community?

The answer is to create your own API.

I’m going to show you how to do this in Linx, a low-code development tool for IT pros.

Let’s get started

This tutorial will demonstrate how to build a minimally viable REST Web service integrated with a SQL Database using Linx to both build (Linx Designer) and host the web service (Linx Application Server). 

The REST web service will involve an operation related to the creation of a ‘user’ record in the database.

This tutorial assumes:

Basic understanding of REST Web services A database instance  and some basic familiarity with SQL  Linx Application Designer (download here) An active Linx Application Server (cloud or on-premise)  Web service request tool (Postman, Linx Designer)

Linx Solution Specification
The sample application will contain a REST Web service containing a single operation.  The operation will execute a custom process flow which results in a submitted ‘user’ being added to a database and the results returned in the response.

API Specification
The REST WebService will contain a single ‘AddUser’ operation. The ‘AddUser’ operation involves a POST request made to the ‘/users’ endpoint.

HTTP Request

A JSON request body is submitted containing a ‘user’ object.

A JSON response body is then returned containing a ‘user’ object.

Database Specification
Here is a SQL database containing a [User] table consisting of the following fields:

[ID] – Primary Key [Username] – Username of user [Password] – Password (encrypted) [FirstName] – First name of user [LastName] – Last name of user [email] – email of user

The ‘user’ details that are submitted with the request will be added to this table. The newly generated ID and additional fields of the new record will then be returned.

You can use the sample SQL below to create the table:

Create the Linx Application

Creating a REST Web service and adding custom functionality with Linx involves the following broad stages:

Creating a new solution Adding Plugins (functionality) Create custom logic flow Configure REST Web service and Operations Link custom logic to REST operations Debug & deploy 

Creating a new solution
To create a new Linx solution is easy – with just a single click, the base skeleton of the application is created for you. Your solution is created with a blank ‘process’ and you can add as many processes and services as you require.

Plugin Configuration
Linx is based upon a plugin architecture.  To build the application, I require functionality related to the following areas:

Create custom logic flow
The custom logic flow will result in a ‘user’ object being added to a database and the results returned.

To start, create a single process which will take in an input parameter of a ‘user’ object. The ‘user.password’ ‘ will then be encrypted and added to the database along with the rest of the user’s details. The newly created record details will then be returned from the database

Continue reading

This post was originally published on this site