Search code examples
apimicroservices

What is the difference between an API and Microservice?


I create my API rest with Django, but I don't understand how convert an API to micro services, I don't understand the real difference between these. I see an API like a micro service, but I don't know convert an entire API in micro service, I need create micro web servers?

Please, I can't understand a micro services, and I need understand this.


Solution

  • A microservice exposes it's interface, what it can do, by means of an API. The API is the list of all endpoints that a microservice respond when it receives a command/query. The microservice contains the API and other internal+hidden things that it uses to respond to client's requests.

    An API is all that the clients see when they look at the microservice, although the microservice is bigger than that. A microservice hides its internal structure, it's technology stack, it's database type (sql, nosql - it could be anything); a microservice could move from sql to nosql, from python to php, but keep it's API unchanged.