Architect RESTful API Microservices

Points to be considered

  • Always remember that microservice you are developing will act as a façade whether you are solving simple or complex business problem.
  • Consider the scope of microservice and strict to be in the defined boundary.
  • Always be aligned with Restful Web API guidelines. Refer MSDN Restful Guideline, click here
  • Restful Web API can be developed for solving normal CRUD operations or for solving complex domain. In both cases, domain logic should be encapsulated with in microservice.
  • Create GET, PUT, and DELETE operations must be idempotent and not POST. An operation is idempotent if it can be called multiple times without having any side-effects after the first call.

Steps to be considered while designing and developing RESTful API Microservice:

  • Identify resources as Restful Web API should be resource oriented and should be stateless.
  • Identify endpoints with parameters, response, Http Status Code, and Http Verb.
  • If possible, mock the microservice API with mock data to share it with consumers otherwise design the JSON schema of responses with status code which can be shared with consumers.
  • Have an agreement on endpoints and JSON schema with consumers as it will save lots of rework. Document it properly and get the consensus from consumers before proceeding to development.
  • After above steps, start the actual implementation work using TDD approach.
  • And, if there is a need to interact with external API or service, consider using Façade or Proxy Pattern.
Please share this

Leave a Reply