SlideShare a Scribd company logo
Practical application of API-First
approach in microservice
development
22.12.2020
Chavdar Baykov
SolutionArchitect
(Digital Wallets, Paysafe Group)
chavdar.baykov@paysafe.com
• Started programming, with BASIC, when Apple II was a big thing, long, long time ago…
• Spent few years doing competitive programming - algorithms and such…
• Spent 19 years developing and architecting different solutions in SAP
 Java, Web Services, SOAP, JAXB, SAP HANA, SAP Cloud Platform
• Joined Paysafe DigitalWallets July 2019 as SolutionArchitect
• Interests include:
 Pragmatic and Agile Architecture
 Development Productivity
 Clean Code and Clean Architecture
 Tech gadgets…
About Me
2
Importance of APIs ?
3
4
Monolithic vs Microservices Architecture
5
• Tightly coupled
Statically linked dependency
• Very low latency
• “Unlimited” bandwidth
• High data integrity
• Always available
• Single deploy
• Scale vertically
• Inside trust boundary
• Loosely coupled
• High latency and overhead
• Limited bandwidth
• Various data conversions applied
Encodings,XML, JSON, …
• Outages are possible
• Independently deployed
• Horizontally scalable
• Outside trust boundary
Local Calls vs Remote (RESTful) API Calls
6
• Poor development productivity
 Poorly documented
 Hard to use and understand
 Inconsistent interaction patterns
• Poor performance
 Ineffective communication patterns or data structures
• Low reliability
 Incompatible changes are often required or happening
 Interactions end up in undetermined state
 Data Integrity Issues
• High operation cost
Impact of Poor (RESTful) API Design
7
• Use case centric
• Intuitive, clear and consistent
• Stable and self contained
• Well documented
Provide examples and Mock/Test Endpoints
• Formally defined using API definition language
Open API 3.0 or 2.0 specification
• Follow REST best practices
Qualities of Good RESTful APIs
8
How do we build APIs ?
9
Code-First Approach to building APIs
10
Characteristic to Code-First Approach
• Preferred for Speed of Delivery
• APIs are byproduct of Implementation
• API Specification is inferred from the implementation
• No API Contract established upfront
• Long feedback cycle on API Quality
• Data integrity and compatibility issues happen often
• Exposing the implementation Data Model has long term impact
11
Treat APIs as First-Class Citizens
1. Brainstorm
2. Establish stakeholders
3. DesignAPI Contract
4. Create Style Guide
5. Implement API Governance
6. Automate Processes
7. Track and ManageAPIs
8. Provide API Portal for Developers
API-First approach to building APIs
12
Benefits of API-First
• Early feedback on API quality
• Reduces rework
• Developers can work in parallel
• Ensures good development experience
• Reduces middleware use and complexity
13
• Higher learning curve for developers
Open API Specification and JSON Schema
API DesignTools
API Design Best Practices
• Requires initial alignment with stakeholders
• No API Portal orAPI Design tool access or
streamlined development tooling
• High pressure to deliver “something”
Challenges adopting API-First
14
Developer Centric Approach to API-First
• Keep API-Specification close to the implementation and developers
• Stored in Git and all changes are tracked
• Allow various API DesignTools usage
• Web or Desktop API Design tools (on top of Git)
• IntegrateAPI Lifecycle into Software Development and Release Process
• API Publication on API Portal during central build
• Release of associated APIArtifacts, along with service implementation
• Provide Developer friendly environment for API implementation and
consumption
• Server-side stub or Client generation as part of the build process
15
Developer Centric API-First approach in Paysafe
16
DEMO – Calculator Service
1. Define Calculator API
2. Prototype and PublishAPI Candidate to Stakeholders
3. ImplementCalculator API
4. Release API
5. Consume API
17
Tools Used
• GitLab ( https://gitlab.com/ )
 Source Control and Artifact Repository
 Build, Publish and Release pipelines
• stoplight.io ( https://stoplight.io/ )
 API Designer,API Portal, API Mocks, API Linting
• OpenAPI Generator + Custom GeneratorTemplates
 https://github.com/OpenAPITools/openapi-generator
 Generate API serer side stubs
 Generate API clients
• Custom Gradle Plugins
 Simplifying development experience
Questions and Answers
18
Thank You!
Chavdar Baykov
Solution Architect (Digital Wallets, Paysafe Group)
chavdar.baykov@paysafe.com
https://www.linkedin.com/in/chavdar-baykov-8322385/
19

More Related Content

PPTX
Process Orchestration with Flowable and Spring Boot
PDF
[WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices
PPT
Working with Portlets in ADF and Webcenter
PPTX
Migration from ASP.NET MVC to ASP.NET Core
PPTX
Api gateway : To be or not to be
PDF
WSO2Con USA 2017: Implementing a Modern API Management Solution that Benefits...
PDF
[WSO2Con EU 2017] Keynote: Ballerina Plans and Futures
PPTX
Making your API behave like a big boy
Process Orchestration with Flowable and Spring Boot
[WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices
Working with Portlets in ADF and Webcenter
Migration from ASP.NET MVC to ASP.NET Core
Api gateway : To be or not to be
WSO2Con USA 2017: Implementing a Modern API Management Solution that Benefits...
[WSO2Con EU 2017] Keynote: Ballerina Plans and Futures
Making your API behave like a big boy

What's hot (20)

PPTX
Our First ADF Experience
PPTX
Mean machine
PPTX
Lightweight ESB Alternatives
PPTX
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
PDF
Laravel and CodeIgniter: pros & cons
PPTX
PDF
Scribe online 03 scribe online cdk and api overview
PPTX
Tech Talk Live - 5.2 REST APIs
PPTX
Apex world 2018 continuously delivering APEX
PDF
Getting Started with the WSO2 manager
PDF
Quality - The key to successful SOA
PPTX
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET Core
PPTX
API Gateway: Nginx way
PDF
Launching Activiti v6 (Activiti Community Day Paris 2015)
PDF
API Management @ Haufe
PDF
A look ahead at RAP (ESE 2010)
PDF
APidays Paris 2019 - Reason for Asynchronous APIs by John Carter, Software AG
PPTX
Building Azure Logic Apps
PPTX
Scribe Online CDK & Connector Development
PDF
Serverless Architecture Patterns - Manoj Ganapathi - Serverless Summit
Our First ADF Experience
Mean machine
Lightweight ESB Alternatives
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
Laravel and CodeIgniter: pros & cons
Scribe online 03 scribe online cdk and api overview
Tech Talk Live - 5.2 REST APIs
Apex world 2018 continuously delivering APEX
Getting Started with the WSO2 manager
Quality - The key to successful SOA
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET Core
API Gateway: Nginx way
Launching Activiti v6 (Activiti Community Day Paris 2015)
API Management @ Haufe
A look ahead at RAP (ESE 2010)
APidays Paris 2019 - Reason for Asynchronous APIs by John Carter, Software AG
Building Azure Logic Apps
Scribe Online CDK & Connector Development
Serverless Architecture Patterns - Manoj Ganapathi - Serverless Summit
Ad

Similar to Practical Application of API-First in microservices development (20)

PPT
How to design effective APIs
PPTX
API Conference 2021
PPTX
Extend soa with api management spoug- Madrid
PPTX
OracleDeveloperMeetup - London 19-12-17
PDF
Service api design validation & collaboration
PPTX
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
PDF
apidays Australia 2022 - Accelerating API Engineering, Jason D'Souza & Andrew...
PPTX
Auckland API & Microservices Meetup 1: API led design
PDF
Modernize Service-Oriented Architecture with APIs
PDF
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
PPTX
Lessons learned on the Azure API Stewardship Journey.pptx
PPTX
Mule ESB Intro
PDF
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
PDF
Octo API-days 2015
PDF
Top 7 wrong common beliefs about Enterprise API implementation
PPTX
Make Your Contribution Count. Adding Value to the API as a Technical Communic...
PPTX
Effective API Lifecycle Management
PDF
Extend soa with api management Sangam18
PDF
apidays Paris 2022 - Adding a mock as a service capability to your API strate...
PDF
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
How to design effective APIs
API Conference 2021
Extend soa with api management spoug- Madrid
OracleDeveloperMeetup - London 19-12-17
Service api design validation & collaboration
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
apidays Australia 2022 - Accelerating API Engineering, Jason D'Souza & Andrew...
Auckland API & Microservices Meetup 1: API led design
Modernize Service-Oriented Architecture with APIs
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
Lessons learned on the Azure API Stewardship Journey.pptx
Mule ESB Intro
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
Octo API-days 2015
Top 7 wrong common beliefs about Enterprise API implementation
Make Your Contribution Count. Adding Value to the API as a Technical Communic...
Effective API Lifecycle Management
Extend soa with api management Sangam18
apidays Paris 2022 - Adding a mock as a service capability to your API strate...
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Ad

Recently uploaded (20)

PPTX
Introduction to Artificial Intelligence
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
System and Network Administration Chapter 2
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Transform Your Business with a Software ERP System
PPTX
history of c programming in notes for students .pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
assetexplorer- product-overview - presentation
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Introduction to Artificial Intelligence
wealthsignaloriginal-com-DS-text-... (1).pdf
Designing Intelligence for the Shop Floor.pdf
System and Network Administration Chapter 2
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Design an Analysis of Algorithms II-SECS-1021-03
Transform Your Business with a Software ERP System
history of c programming in notes for students .pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Digital Systems & Binary Numbers (comprehensive )
CHAPTER 2 - PM Management and IT Context
assetexplorer- product-overview - presentation
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

Practical Application of API-First in microservices development

  • 1. Practical application of API-First approach in microservice development 22.12.2020 Chavdar Baykov SolutionArchitect (Digital Wallets, Paysafe Group) [email protected]
  • 2. • Started programming, with BASIC, when Apple II was a big thing, long, long time ago… • Spent few years doing competitive programming - algorithms and such… • Spent 19 years developing and architecting different solutions in SAP  Java, Web Services, SOAP, JAXB, SAP HANA, SAP Cloud Platform • Joined Paysafe DigitalWallets July 2019 as SolutionArchitect • Interests include:  Pragmatic and Agile Architecture  Development Productivity  Clean Code and Clean Architecture  Tech gadgets… About Me 2
  • 5. 5 • Tightly coupled Statically linked dependency • Very low latency • “Unlimited” bandwidth • High data integrity • Always available • Single deploy • Scale vertically • Inside trust boundary • Loosely coupled • High latency and overhead • Limited bandwidth • Various data conversions applied Encodings,XML, JSON, … • Outages are possible • Independently deployed • Horizontally scalable • Outside trust boundary Local Calls vs Remote (RESTful) API Calls
  • 6. 6 • Poor development productivity  Poorly documented  Hard to use and understand  Inconsistent interaction patterns • Poor performance  Ineffective communication patterns or data structures • Low reliability  Incompatible changes are often required or happening  Interactions end up in undetermined state  Data Integrity Issues • High operation cost Impact of Poor (RESTful) API Design
  • 7. 7 • Use case centric • Intuitive, clear and consistent • Stable and self contained • Well documented Provide examples and Mock/Test Endpoints • Formally defined using API definition language Open API 3.0 or 2.0 specification • Follow REST best practices Qualities of Good RESTful APIs
  • 8. 8 How do we build APIs ?
  • 9. 9 Code-First Approach to building APIs
  • 10. 10 Characteristic to Code-First Approach • Preferred for Speed of Delivery • APIs are byproduct of Implementation • API Specification is inferred from the implementation • No API Contract established upfront • Long feedback cycle on API Quality • Data integrity and compatibility issues happen often • Exposing the implementation Data Model has long term impact
  • 11. 11 Treat APIs as First-Class Citizens 1. Brainstorm 2. Establish stakeholders 3. DesignAPI Contract 4. Create Style Guide 5. Implement API Governance 6. Automate Processes 7. Track and ManageAPIs 8. Provide API Portal for Developers API-First approach to building APIs
  • 12. 12 Benefits of API-First • Early feedback on API quality • Reduces rework • Developers can work in parallel • Ensures good development experience • Reduces middleware use and complexity
  • 13. 13 • Higher learning curve for developers Open API Specification and JSON Schema API DesignTools API Design Best Practices • Requires initial alignment with stakeholders • No API Portal orAPI Design tool access or streamlined development tooling • High pressure to deliver “something” Challenges adopting API-First
  • 14. 14 Developer Centric Approach to API-First • Keep API-Specification close to the implementation and developers • Stored in Git and all changes are tracked • Allow various API DesignTools usage • Web or Desktop API Design tools (on top of Git) • IntegrateAPI Lifecycle into Software Development and Release Process • API Publication on API Portal during central build • Release of associated APIArtifacts, along with service implementation • Provide Developer friendly environment for API implementation and consumption • Server-side stub or Client generation as part of the build process
  • 15. 15 Developer Centric API-First approach in Paysafe
  • 16. 16 DEMO – Calculator Service 1. Define Calculator API 2. Prototype and PublishAPI Candidate to Stakeholders 3. ImplementCalculator API 4. Release API 5. Consume API
  • 17. 17 Tools Used • GitLab ( https://gitlab.com/ )  Source Control and Artifact Repository  Build, Publish and Release pipelines • stoplight.io ( https://stoplight.io/ )  API Designer,API Portal, API Mocks, API Linting • OpenAPI Generator + Custom GeneratorTemplates  https://github.com/OpenAPITools/openapi-generator  Generate API serer side stubs  Generate API clients • Custom Gradle Plugins  Simplifying development experience
  • 19. Thank You! Chavdar Baykov Solution Architect (Digital Wallets, Paysafe Group) [email protected] https://www.linkedin.com/in/chavdar-baykov-8322385/ 19

Editor's Notes

  • #4: APIs is how software systems communicate. In world of mass digitalization, APIs are, everywhere around us.
  • #5: While in the past APIs were mostly used for external communication, the growing popularity of Microservice based architecture led to the explosion of APIs, both internal and externally facing.
  • #6: Let us see what are the implications of replacing local communication with remote communication, when utilizing microservices architecture. While local API calls are usually statically linked at compile time, remote REST calls are loosely coupled, and with separate lifecycle. You can update the implementation or evolve is separately from the client. Latency and Overhead of Remote REST calls is incomparable to Local API calls. While in monolithic system basically data structures are in consistent in memory format, in remote REST communication Data is encoded and goes through various conversions. Although not discussed often, this threatens data integrity between the communicating parties. Local API is always available. Usually, local database transactions used to enforce database consistency even if the whole application crashes. This is not the case with remote REST calls, where the service might be down at any time, without any client information, whether the API call is processed Independent deployment, means we must watch out for incompatible or braking changes.. As distributed system is not deployed atomically.
  • #7: Poor API Design besides the usual development productivity problems seems to amplify bad effect of all challenges, that come with remote communication. In many ways, poor APIs are direct consequence of lack of understanding of the implications of changing the media from local to remote calls and transport layer specifics. SOAP Efforts are one such example, where REMOTE Call Protocol was designed, with goal to be transport agnostic, and violating many of the transporting protocol principles like HTTP paradigms.
  • #8: Good APIs allow clients to mitigate adequately most of the challenges of using remote APIs. For example, they are designed for idempotency, allow asynchronous processing of long executing operations or provide server-side filtering (minimizing transfer of unneeded data) and pagination. All this needs to be designed into the APIs.
  • #9: Now that we set the tone of what do we expect from good APIs and what we don’t, let us dig into how do we build APIs and how it affects their quality ?
  • #10: One of the most common ways of exposing APIs is using the Code First Approach. Implementation laid out based in requirements and is exposed as RESTful APIs. API Specification is produced as part of build process or at runtime based on the implementation Code is enhanced with additional annotation to facilitate API Generation API is byproduct of the implementation, as a result it is strongly influenced by it.
  • #11: Huge part of the APIs used today are produced this way In some situations, this is considered good approach, like rapid prototyping This approach is preferred for speed of delivery, since no or little time is spent on API design and alignment The API Design is influenced by annotating the implementation Incompatible changes might happen often unintentionally. In most of the cases instead of fixing the implementation companies are introducing complex and expensive to maintain middleware as an effort to make the APIs usable, without refactoring the implementation.
  • #12: While in the code-first approach APIs are somewhat a result of the implementation efforts, the API-First approach reverses the process in the opposite direction. Where the implementation effort is driven by API requirements. In order to structure the approach couple of principles apply when trying apply it. 1. The first Brainstorming phase is also relevant and quite related also to microservices design and consists of distinguishing the API grouping and Domain Models used by different APIs and their ownership. The effort here is mostly to make different APIs in the company, as much self contained as possible and loosely coupled. This will likely make them stable 2. Find out Use Cases for APIs and Establish API Stakeholders. Remember one of the principles of Good APIs is that they are Use Case centric. However, having no stakeholders will hardly tell you how well you match these. Find out what is the minimal context needed for fulfilling the use cases at hand. 3. Design APIs and define them using formal API Definition Language – Open API 3.0 is de-facto industry standard for defining RESTful APIs 4. To achieve API consistency and application of Best Practices, define style guides, do API developers have some guidance, when designing them. 5. API Governance can be achieved through Peer Reviews, Stakeholder feedback and static linting. 6. Automate all processes around API lifecycle management and make it accessible to all parties involved. API Publication , release generation of Client and Server-side artifacts should be automated. 7. Track and manage your APIs – check for redundancy and inconsistencies. 8. Create a central place for internal developers, where developers and various stakeholders can collaborate.
  • #13: APIs are the face of your service! Getting Feedback as early as possible on your API might be highly influential to your implementation approach. Having formal API Specification, defined allows evaluating the API, even before the implementation is available using mocks and finding design issues. Inconsistencies and antipatterns are easily spotted and rectified. Reworking this in later stage, might be impossible, or done at great expense.
  • #14: It is not actually all champaign and roses as implementing API-First comes with its own challenges. - For adopting API-First it is of outmost importance, that API Contract is defined using formal API Specification such as Open API 3.0 and derive the implementation out of this contract. Developers need learn how to describe their APIs using formal API Definition language and the tools used for it. There is no way around that, although there are visually appeal to help with that. - Another important step is to identify stakeholders and use cases for these APIs, so feedback can be collected as early as possible. Ideally even before the implementation started. Often APIs and Services are being built, with the idea on the problems they are about to solve, but the stakeholders are involved very late in API design. When you have API in mind, be sure to have stakeholders in line for it, and ready to validate it. Usually, various tools are adopted with various appeal to different stakeholders, but not well integrated into the overall software development process. Making the tooling well integrated and streamlined, plays a big part into “Selling” the idea to Developers. Since for them this seems way more hassle than “quick and dirty” Code-First approach. Last, but not least, the “API Design Upfront” effort is confused with “Big Design Upfront” architecture approach condemned by Agilists and alike. That misconception it totally wrong, since getting early feedback and making sure Right Things Get Built the Right Way, avoids late and costly rework.