Join with us for Daily Updates on Join us!

Microservices | API | Differences Between Microservice and API

In this post we are discussing about What are Microservices?, What are APIs?, What is Monolithic Architechture?, HTTP methods, Microservices vs APIs
ihtreek

In this post we are discussing about What are Microservices?, What are APIs?, What is Monolithic Architechture?, HTTP methods, Microservices vs APIs and some more 

What are Microservices?

microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki what are microservices

What do you understand by the term micro services? But the term microservices define itself. What I mean by that is it's basically small small tiny Services communicating with each other. So we have to define microservices, then microservices are commonly known as or called as Microservice architecture. Microservice architecture is an architectural style to build the applications. Now, these applications are basically the software applications ( which we use in our daily life), so basically you can structure Application, as a collection of small, autonomous Services models around the business domain. 

For example, you have an e-commerce application, and your business domain is basically e-commerce. So for that, you'll take care of what all functionalities and features are required and according to that, you will be use these all Services. When I say Services, it's not with respect to the number of services, you can have any number of services based on the architecture of the application that you have. Now before microservices came into the picture means to the play, industries were using the Monolithic architecture. 

What is Monolithic Architechture?

what-is-monolithic-architechture-microservices   microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki

So what I mean by monolithic architecture is basically that, you have the complete application stored in a single pocket. When I stored in a single packet, what I mean is that, all the functionalities and the features are stored at one single place.

So basically all the features, dependencies, functionalities of the complete application.  Either it be the front end and the back end all of them will be residing means storing at a one single place, so that's what monolithic architecture means. So, let us assume or take an example and then we will understand all the topics from that one particular example.

Workflow-amazon-ecommerce-microservices  microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki  microservice api example microservices api integration microservices vs rest api microservices tutorial microservices api design what is microservices in java microservices api gateway

Now, if you consider an e-commerce application, what do you think are the main three? Functionalities of it, for example, let us assume you using Amazon, what all do you see  is your customer, products on Amazon and then you put your products into the cart and finally, we or you order those products (which are available to place an order),   That is basically the simple workflow if you have to understand. Now, if you have to build this APP or application using microservices, what we can do is we will have mainly 3 functionalities. That is Customer information, products available in the cart and the products available on the website. Now, all these three functionalities can be put into different different Services. What I mean by that is you can have service

  • Having customer information
  • Having the product available in the cart and service
  • Having all the products available in the application  

Now when the customer goes forward and Orders a particular product, you can have a composite microservices which will basically take data from all these three services and generate the output for the client.

So I hope you've got an idea of what I'm talking about. Now As I was telling you that, you know, before microservices came into the picture, there was monolithic architecture. How do you think all these functionalities of the application were stored in this kind of architecture? Well, it's really simple. What would happen would be all these three services that is the

  • customer service
  • product service
  • cart service

Would be residing in a single area and then they would be a data access layer through which you can access the data, so as you can see

monolithic architechture microservices  microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki  microservice api example microservices api integration microservices vs rest api microservices tutorial microservices api design what is microservices in java microservices api gateway

You can see, when you have a client browser to which the client requests for the information. So as soon as the client would request for the information, on the application that the worst would be passed to this particular area where all the functionalities are present and the data would be retrieved from the data access layer and the database.

So we have to just define monolithic architecture for you. Then it's really simple. Monolithic architecture is an architectural style in which all the functionalities or the required components would be inside one single block. So, I hope that particular part is clear.

So, I hope that you've understood what monolithic architecture was, and what microservices are

What are APIs?

what-are-apis-microservices  microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki  microservice api example microservices api integration microservices vs rest api microservices tutorial microservices api design what is microservices in java microservices api gateway

What do you think? APIs are? Obviously everybody has heard of this term API,   so you can basically understand APIs as a point of contact through which all the services communicate with each other to process the client request and send the response.

So for example, let's assume you know, you've sent a client request. Let's take on Amazon, you've requested for a phone.  So if you just type phone, what will happen is that you want this particular request will be sent through Application Programe Interface to the respective functionality or a feature, and that particular functionality or a feature will retrieve the requested data and then will send back the response to the client If you see your client, then this particular functionality or feature present in the application and then in between both of you there's Application Programe Interface to which we can communicate. So I hope that point was clear. Now, I'll building and using these applications.

Click here to Get paid Udemy certification courses free here on our blog daily

What developers do is that you basically use the crud operations when I say operations. What I mean by that is we basically create a resource, read a resource, updated resource and delete the resource. So, Application Programe Interfaces are generally developed by using the restful style and these methods are nothing but the HTTP methods. Now, I'm sure you must have got confused when I said, create a resource, read a resource, updated resource and deleted the resource will get its really simple to understand. For example, let's say you using book my shoe and then you want to find out the details of a specific. So what you do is you send a client request. So when you send a client request, you basically asking for the information, So what will happen is that, you know, the information has to be read and then the response has to be sent to the client. So that's basically reading the source coming to creating updating and deleting this is on basically, the developer side where, you know, they keep adding the information to the application or maybe a specific movies, details are updated or maybe the complete movie deleted, So basically, the information of the movies deleted, once it is out of the market. So, that's how basically it works.

Now, whenever we send a request, it’s just what happens is that we're basically sending an HTTP request, so for that, we use the HTTP methods.

HTTP Methods

http-methods-microservices-apis  microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki  microservice api example microservices api integration microservices vs rest api microservices tutorial microservices api design what is microservices in java microservices api gateway

The HTTP methods are basically the post, get, put and delete method. So whenever you want to create a resource, you basically used post method whenever you want to read a source you use the get method whenever you want to update a resource, you use put method and whenever you want to delete a resource, you use the delete method. 

http-methods-microservices-apis-create-read-update-delete   microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki  microservice api example microservices api integration microservices vs rest api microservices tutorial microservices api design what is microservices in java microservices api gateway

So, basically friends, APIs use these methods to basically communicate between the client and the respective functionality of the features of the application. Now if you want to know more about HTTP methods and (Application Programe Interface) APIs. This is all that you have to understand to understand the differences between APIs and microservices, let’s continue where exactly APIs used in micro Services.

Where are (Application Programe Interface) APIs used in microservices?

where-are-apis-used-in-microservices  microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki  microservice api example microservices api integration microservices vs rest api microservices tutorial microservices api design what is microservices in java microservices api gateway

Now, when I was explaining APIs for you, I was always saying that, you know, they're basically a middle person between the client and the respective feature of the functionality. Now, obviously that particular feature or the functionality can go into a specific service. So let's say, you know, we have a functionality of all the products present in the application, that particular feature can be present in a specific service,   so now when a client requests for all, the products available in the application. The request can directly go to that particular service and the response can be generated back. So I hope that point is clear. So what you can do is basically the application that we took, the example that we took, we had a client browser and in the monolithic architecture, the customer information, the product service and the cart service. All these three services basically, all these three functionalities were residing in the same area. And then there was a common data access layer and then a common database. 

Now when you break down this, application or maybe when you refactor this application into microservices, what you can do is you can have a specific microservice and then you can have its own data, access layer and database. And for each microservice, this is a seperate API,   So basically the customer microservice will have a specific Application Programe Interface its data access layer and database. Similarly goes for the product micro service and the card micro service. Now it's not necessary that, you know, this single database for each and every micro service it may also happen that you know, two or three microservices share a common database to which the data is between, So basically  if you have to understand where APIs are used in microservices it's really simple. Each  service will basically have its own Application Programe Interface  through which the services will communicate with the client,   So for example,  you are a client and then you're asking for your own information, your own customer details, what will happen is  as soon as you send the request. Basically the Application Programe Interface Gateway will decide to which service this particular request has to be sent.

Click here to Get paid Udemy certification courses free here on our blog daily

Now, since we want the customer details, this particular request will directly go to the customer microservice and what will happen is that you need the required data will be retrieved from the API and then again, the API will send back the requested response to the client,   So basically that's all that you have to understand. Again each service will have its own API and then through that particular API, you can communicate with that particular service,   it’s not necessary that, you know, you need information from a single service,   even in that scenario, Is what will happen? Each Micro service with generate the requested data and all of them together will send back the requested response to the client.  So I hope that you understood where our APIs used in Microsoft Services. Now let's move forward with the final topic for this post. That is the differences between micro services and API.

Differences between microservices and API

differences-between-microservices-apis  microservices tutorial what is microservices in java microservices spring boot microservices example microservices javatpoint microservices vs api microservices advantages microservices wiki  microservice api example microservices api integration microservices vs rest api microservices tutorial microservices api design what is microservices in java microservices api gateway

Now, in this post on Microservices VS API, I hope that you know you've understood what I basically Microservices and what our API is. These are completely two different things.

Microservices is basically, an architectural style through which you can build the application in the form of small and autonomous Services.

Coming to (Application Programe Interface) APIs, APIs are a set of procedures and functions which allow the consumer to use the underlying service of an application,   

So basically guys, this is the main difference between microservices and (Application Programe Interface) API.  The Microservice is basically an architecture through which you can build the application and APIs, is basically like a middle person between the client and the services through which you can establish communication between both of them.

Click here to Get paid Udemy certification courses free here on our blog daily

 So, I hope that point is clear. Also from the example that I explained you, I'm hoping that unites clear to you that, you know, APIs are a part of Microservices and thus it helps these Services communicating with each other. However, while they communicating with the other services, each service can have its own crud (Create, Read, Update, Delete) operations to store the relevant data in the database, not only this. But while performing the crud (Create, Read, Update, Delete) operations Application Programe Interface is generally accept in return the parameters based on the request sent by the user. So, for example, if the customer wants to know the order details. So maybe he must have ordered few items. What will happen is that, you know, the product details would be fetched from the product service, the billing address and the contact details will be fetched from the customer service and the product purchased will be fetched from the cart service,   So basically if you have to, you know, generate a specific data or maybe if you want a specific data, all these Services can communicate within each other with the help of Application Programe Interfaces and generate the request and response,   So I hope it's clear to you.

5 applications of artificial intelligence applications of artificial intelligence in real world 10 uses of artificial intelligence applications of artificial intelligence ppt applications of artificial intelligence pdf artificial intelligence examples applications latest artificial intelligence applications business applications of artificial intelligence

This was a basic difference between Microservices and (Application Programe Interface) API, Microservices is basically a simple architectural style and APIs are a set of procedures and functions which allow the consumer to use the underlying surface of the application. So if you're someone who is aspiring to build an application using micro service architecture, I would always see that you know, make sure that you know, your APIs are working and then all the services are working. Are collaborated with the (Application Programe Interface) APIs in such a way that you know no request is harmed and maybe all the client requests are satisfied with the request and response,   so I would just say go forward and build applications using micro services. If so, if you have any further queries related to the session, please comment in the comment section below until then that's all from my side, thank you and happy learning.

Click here to Get paid Udemy certification courses free here on our blog daily

Don't Forgot to Share and Support us

follow us on Facebook: https://www.facebook.com/IhtreekTech/
follow us on Instagram: https://www.instagram.com/ihtreektech/
follow us on Pinterest: https://in.pinterest.com/IhtreekTech
follow us on Twitter: https://twitter.com/Ihtreektech

Share and Support us

1 comment

  1. really awesome and cool explanation thank you 🙂
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.