Grizzly-API to Create your CodeLess Microservice

Rayen Rejeb
5 min readOct 29, 2019

--

Using Grizzly-API to build your microservice.

Create your microservices in a few minutes with Grizzly-API

1 — What is Grizzly-API ❓

It is a cloud platform for creating microservices in minutes ❗ It facilitates the process of designing, deploying and sharing multiple APIs while respecting Open API standards. Likewise, it serves to connect different data sources and apply basic operations such as retrieving and updating data based on an API First approach.

API-first development is a strategy in which the first order of business is to develop an API that puts your target developer’s interests first and then build the product on top of it …Guy Levin

Briefly, it offers :

  1. Design, manage, test and share APIs.
  2. Create or link different data sources.
  3. Execute transformations on markup resources (XSL, FreeMarker, Thymeleaf).
  4. Simulate a content delivery network for static resources.

2— Microservices Architecture ❓

It is an architecture that structures the application as a set of loosely coupled, collaborating services. As shown by figure 2.1, it enables rapid and frequent development and deployment since every application service is highly maintainable and testable. Besides, this approach enables each team to focus on a single service and work independently, most of the time, from the other teams.

Figure 2.1: Microservices Architecture

Grizzly-API is based on API-First approach. Teams can work independently on their microservices and focus only on the endpoint signature.

3— How to use Grizzly ❓

Just go to Sign-up page and create an account. You will receive a verification email, confirm and you are good to Go !

4— Create my first Microservice ❗

When you first log in to your account, you’ll see this dashboard :

Figure 4.1 : Grizzly Dashborad

It provides global analytics on your API, endpoints and the stored data.

On the left side, we see the “Demo” microservice which is a working example. when we click on it, see we get this view :

Figure 4.2 : Demo microservice overview

We have prepared our angular app, we will get to it later. For now, we need to configure our microservice.

4 .1 — Define Endpoints ❗

We go to Grizzly-API platform and create a new microservice. I will name it “Product Starter”.

Figure 4.3 : Create a new Microservice

Now it is up to us to define the different endpoints we need to run our app.l

Within the version 1.0.0, we will create a group just to give our endpoints a sense.

Figure 4.4 : Create a new Group

Grizzly provides a UI to define new endpoints.

Figure 4.4 : Add new API action

In the first step, we set the endpoint definition:

  • Type : we choose Query. The other types are for Markup transformations and file management. We’ll get to that in another article.
  • HTTP Method : GET, POST, PUT or DELETE
  • Endpoint : path to call
  • Parameters list : HTTP Request parameters (Body, Query, Path, formData ..)
Figure 4.5 : Add new API UI — Step 1

Second, we configure the execution request by setting :

  • Collection Name : the 1st version of grizzly supports only MongoDB, we need to choose a collection from the linked database. Likewise, we can create a new collection.
  • Request Type : we need to specify whether this endpoint is for inserting data or update since we chose a POST method. If we chose a GET method, we will be only specifying the number of elements to return
  • Number of elements to return : specify if the result should be an array or single element.
  • Query : Here we set the Mongo Query that will be used to search for elements to retrieve. All the parameters passed during call can be used in the search request by prefixing it with “%”. We will get to this later when defining our endpoints.
  • List of parameters : These are the available parameters during the HTTP calls that can be used in the search Query. If the endpoint is secured with JWT, a list of the current user properties will be available implicitly.
Figure 4.6 : Setting Execution Query— Step 2

For the next steps, we can add further HTTPS status codes messages, add documentation and verify the endpoint information before save.

I chose these endpoints :

  • POST, /api/products/add : add a new product
  • GET, /api/products/all : retrieve all the products
  • GET, /api/products/edit/{productid} : retrieve a single product
  • POST, /api/products/update/{productid} : update a product
  • DELETE, /api/products/delete/{productid} : delete a product

After adding the 5 endpoints, we will get a group like this :

Figure 4.7 : Products Management Group

And that’s it ❗❗❗ Our microservice is ready, running and waiting for HTTP calls.

4.2 — Prepare the frontend ❗

For this article, we are going to use a simple Angular 8 application which will serve as a demo project to start your first MS ! Available on :

You can follow this article on medium to create your own application.

RUN 🎈

We just set the server URL in our angular app in environment.ts :

environment.ts

You can get the microservice URL, grizzlyUrl, when you try to validate or publish your microservice Swagger file :

Figure 4.8 : Validate and Publish microservice version action
Figure 4.9 : Validate and Publish microservice version UI

Big Thanks to Grizzly Team :

--

--