3 API

 

This chapter covers

  • What are API?
  • Why do we need API?
  • Why the wild things will get mad if we change our API
  • How to add API to the MDL cards that describe our microservices
  • Side by side comparisons of Rest-like vs RPC API (or nouns vs verbs)
  • Input data (arguments) in API
  • Output data (returns) from API

We got a lot done last chapter. Helping Bullwinkle to design his online Fantlers store, we:

  • analyzed the user stories that Bullwinkle sent us
  • identified what he actually needed our system to do
  • created a design for four microservices which included:
    • name
    • data
    • responsibilities
  • used MDL cards to analyze and document our results

This is fantastic, and I think we should be congratulated. I went over to see Bullwinkle and told him the great news.

So, did Bullwinkle jump up and down, and throw us a celebration party? Did he high-five me and say “Good Work!”. I am sad to tell you, dear reader, that life is a vale of tears and of all of the sorrows sent to trouble us, customers are the saddest. Bullwinkle did not jump up and down and throw us a party. Instead, he complained that not a single Fantlers had been sold.

I suppose I do see a little of his point. Our MDL cards are sitting there on our desk, full of responsibilities, and not even one of them is trying to sell a Fantler.

3.1 Calling APIs

3.2 What are APIs

3.3 Nouns Vs Verbs or RPC vs REST-like

3.3.1 RPC Style API

3.3.2 REST style API

3.3.3 Creating API for All of our Microservices

3.4 API Arguments in the Request

3.4.1 Specifying Input Data for our API

3.4.2 Making Our Input Data Flexible

3.4.3 Adding Input Data to Our Microservices

3.5 API Response

3.5.1 Fantler Response

3.6 Summary