Open APIs

 View Only
Expand all | Collapse all

API vs microservice

  • 1.  API vs microservice

    TM Forum Member
    Posted Jun 08, 2017 16:18
    Does anyone have any pro/con scenarios to share about when to use API vs microservice?

    Rani Natarajan
    AT&T Inc.

  • 2.  RE: API vs microservice

    Posted Jun 09, 2017 02:38
    I believe these are two things you should see separately. Microservices may very well expose an API so that you can actually use the microservice.

    You'll typically use microservices when you implement a Service oriented architecture where you want small pieces of the total architecture to prevent a monolithic application. By doing this (and respect the API's that it serves) you could easily swap one of the services without breaking the entire system.

    Microservices are often used for the following advantages:

    - Performance / Scale up horizontally (with the services being so small and independent you can imagine you add a lot of them in your deployed application stack
    - Easy maintenance (you could include continuous integration and deployment strategies much easier
    ... Some more advantages ...

    Hope this helps.

    Jeroen Van der Laan
    Eurofiber Nederland BV

  • 3.  RE: API vs microservice

    Posted Jun 09, 2017 02:41

    Hi Rani,

    API's are not the opposite of microservices. If anything, microservices rely heavily on APIs to be able to function.

    APIs are a contract to obtain a service, whilst microservices is an architectural design to implement those APIs. 

    Could you clarify your question please?


    Julien Frisquet
    Chief Technical Officer

  • 4.  RE: API vs microservice

    TM Forum Member
    Posted Jun 12, 2017 00:51
    To put it very simply API's are front door to an application while micro services are back end implementation .

    Shalabh Garg
    Cognizant Technology Solutions

  • 5.  RE: API vs microservice

    Posted Jun 12, 2017 05:12
    Hi Shalabh

    As I know, The microservices can used to invoke APIs and they can be also used to expose APIs, so it is not only related to back end implementation.

    Hope I answer your question.

    Abdeljalil Abataleb

  • 6.  RE: API vs microservice

    TM Forum Member
    Posted Jun 12, 2017 08:34

    One of the big Microservices Architecture question is faced by architects is how to define the right service granularity: . And that's where the two concepts , Open APIs and Microservices, might meet :  one might decide to use the definition  of  the  standardized TM Forum   Open API  operations  as a  basis  for a definition  of  the Microservices granularity .  

    Oleg Shaposhnykov

  • 7.  RE: API vs microservice

    Posted Jun 13, 2017 04:38
    I agree, microservices is not a question about API or not, it's rather a question about development, integration and deployment of functions. A microservice should be a self-contained service without any direct dependencies on other parts of the codebase, as compared to monolithic code structures that often contain huge amount of dependencies. With a removal of dependencies the microservice is deployable and testable with minimal efforts which is key to the concept. Without a proper CI/CD microservices loose their appeal. API on the other hand is about level of exposure, primarily exposure of your data model. If your data model and the OpenAPI data model is one and the same and you can maintain version control you could in theory expose your data model directly through microservices and as mentioned keep the granularity in par with the specification. But, since this would put restrictions on your internal flexibility I would not recommend it. Rather I would suggest looking at CQRS. Separation of commands and queries will allow you to develop queryside microservices and deploy them as APIs without any real dependencies on your underlying data model. When it comes to granularity it might make sense to go 1:1 on the OpenAPI specs but it might also make sense to bundle a few of the APIs into one service if they have the same dependencies. You also have to make an early decision on how to handle version control for your APIs. I would strongly suggest a structure which supports a strong set of backward compatibility since customers tend to never switch to a newer API released unless forced (EOL/EOS) or in the desperate need of some functionality only available in the new version.

    Best regards

    Skickat från min iPhone

  • 8.  RE: API vs microservice

    TM Forum Member
    Posted Jun 13, 2017 05:00
    I agree with the general consensus here regarding these not being mutually exclusive things while in some instances can be part of the same thing, but not required as such.   Here is a view on how I think about it...
    A quality microservice will have all the best practice constructs, which require being business process driven, in TM Forum we would refer to the business process framework for consistent definition of business processes, organizing them into a flow, for repeatable service definitions, having a consistent information & data model used by the API.  The API is how the microservice is invoked.  The process flow identifies when the API is invoked.  Recognizing all this as best practice, there are justifiable times when you may not wish to go to that level of specificity.  In that instance you can fake it, with a good rest based API.
    Note the diagram below is an example of how I think about it.  Hope this helps,

    Joann O'Brien
    TM Forum

  • 9.  RE: API vs microservice

    Posted Jun 14, 2017 05:58
    Hi Joann O'Brien,

    What difference do you do between SID and Data & Resource Model in your diagram ?


    Angely Dufour

  • 10.  RE: API vs microservice

    TM Forum Member
    Posted Jul 26, 2017 15:48
    I would firstly refer you to this recent article from Gartner: "What a Microservice it Not". It's list ends with:

    And last but by no means least…

    • [a microservice is not] A published API – microservice architecture is an implementation detail that should be separated from the published interface specification
    The point being that the term microservice says more about how its implementation is constructed, than the "API specification" that forms its interaction contract. I can take any TMF Open-API specification and implement it as a microservice, rather than mapping it to one of many application API's hanging off a larger monolith application.

    Stephen Harrop
    Vodafone Group

  • 11.  RE: API vs microservice

    Posted Sep 05, 2017 10:25
    ​Hi Stephen ,
    That is correct. However the focus should be on the business operations exposed through that API and not just the API.

    SriJagadish Baddukonda
    Ericsson Inc.

  • 12.  RE: API vs microservice

    Posted Aug 15, 2017 21:24
    Microservices and API are not mutually exclusive items. API is one componet of the overall microservice architecture. You can implement API in many different ways, like rest based , soap based etc.. You can design the API in whatever way you want to do.
    Micro services is a integration pattern / architecture pattern. You can design your API's to follow the Microservices architecture pattern.

    Varun Nair
    Infosys Ltd.

  • 13.  RE: API vs microservice

    Posted Sep 05, 2017 10:23
    ​It should be Microservices vs API.
    The question should be "What kind of API for each of the micro services" I am building?

    SriJagadish Baddukonda
    Ericsson Inc.

  • 14.  RE: API vs microservice

    Posted Apr 22, 2022 11:04

    In contrast, the monolithic architecture is based on a default or standard model approach to application development. It has demonstrated its limitations by posing many challenges related to handling a very large code base, scaling, integrating new changes, using new cutting-edge technology, and deployment.

    What is the difference between APIs and microservices?

    The difference between the two concepts is how they work. Microservices are a style of architecture dedicated to applications and where functionalities are fragmented into web services. APIs, on the other hand, represent frameworks through which developers can interact with an application. It is important to note that there is a certain overlap between APIs and microservices, due to the fact that many microservices use APIs to communicate with each other.

    To go further, I strongly invite you to read this article API vs microservices


  • 15.  RE: API vs microservice

    TM Forum Member
    Posted Apr 25, 2022 09:20
    Basically, we can describe and connect both as below.
    Microservices are used to build applications by separating their functionality into modular structures.
    APIs are part of applications that allows communication with other applications.
    As a result, a microservice can be delivered via an API.

    Ruken Zilan
    PiA Bilişim Hizmetleri A.Ş.