The Ultimate Guide to Building a Low-code REST API (How to Guide)

Build a REST API with Linx in under 15 minutes

REST APIs are pretty much everywhere. Today there are practically everywhere….Twitter, YouTube, Facebook identification systems… hundreds of companies generate business thanks to REST APIs. Why? Because REST is the most logical, efficient and widespread standard in the creation of APIs for Internet services.

However, REST API development has many approaches and there are 100’s of different API development tools to choose from, it can be pretty easy to get lost just in the process. 

In this article, we cover how to build and host and API in Linx, a low-code development platform that gives us a quick and easy way to develop and host APIs.

1. Application Specifications

The Linx application will contain a REST API hosted on a Linx application cloud server. The web service will contain an operation to return a full list of mock ‘products’ from a SQL server cloud database as well as an operation to return a specific ‘product’ based on a parameter. The web service will be secured via the API Key authentication scheme.

Database specification

The Linx application will connect to a SQL Server cloud database hosted on an Azure instance.

For demonstration sake, the following table exists that holds records related to mock “products”. 

These records have been imported into the database using Linx:

These records will be retrieved from the database and returned in a http response by Linx, filtering for a specific ‘product’ will be achieved with SQL.

API specification

The REST web service will contain the below operations

Operation Path Response Description GetProduct /products/{id} Product object Return a single ‘product’ object containing the details of a product record matching the {id} passed in with the URL. GetProducts /products Collection of products Returns a collection of all the product records in the database. 2. Building the Application

Building the described application in Linx and hosting it involves the following stages:

Create a new application Add the relevant plugin libraries Define the web service operations Add custom processing logic Deploy and activate Create a new application

Creating a Linx application is easy – with just a single click, the base skeleton of the application is created for you. You are then able to add services, functions and types to bring your application to life.

Install the relevant plugin libraries

Linx is based on a plugin architecture that can be thought of as common libraries which contain functions and data types related to that area of functionality. For my application, I need to integrate with a database and expose a REST web service:

Plugin REST Database Use Consuming and Hosting REST Web services. Database integration. Required function SimpleRESTHost ExecuteSQL Function description Generate a REST API using a ‘operations wizard’ Executes a query against a database instance and returns the results.

Creating and defining a REST web service

To add a REST web service to my Linx application, I can just make use of the SimpleRESTHost service (part of the REST plugin). This allows me to quickly create and configure REST operations. The service can be added to my application by dragging the SimpleRESTHost service from the plugins panel into the Solution Explorer. This will create a base skeleton of an API for me to work with.

Next, I

Continue reading

This post was originally published on this site