[UPDATED] APIs are the pillars that enable communication through the web. Microservices talk to each other through APIs, and frontend applications connect to our backends through APIs. Yet, despite their importance, API integrations failures are a daily occurrence. There're many reasons why this happens, but a common denominator is the lack of API documentation, or the use of bad API documentation. In this presentation, I'll show how we can use documentation-driven development to minimise the risk of API integration failure, and I'll discuss the tools and frameworks that help us leverage the benefits of this approach. Although the risk of API integration failure can never be ruled out, the approach discussed in this presentation helps to reduce the chances of its occurrence.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Delivering successful API integrations with documentation-driven development [updated]
1. Delivering successful API integrations
with documentation-driven
development
• Jose Haro Peralta
• Full stack consultant
• Co-founder of microapis.io
PyCon India
17-19 September 2021
@JoseHaroPeralta
@microapisio
2. $ whoami
• I’m Jose
• Independent contractor | London
• Full stack developer
• Microservices and APIs
@JoseHaroPeralta
@microapisio
4. Connect with Jose
• Twitter: @JoseHaroPeralta
• GitHub: @abunuwas
• Medium: @joseharoperalta /@python-geek
• LinkedIn: https://www.linkedin.com/in/jose-haro-peralta/
@JoseHaroPeralta
@microapisio
5. This
presentation
covers
• Complexity of API integrations
• What is documentation-driven development and why
it matters?
• How to you can adopt documentation-driven
development?
• REST API (OpenAPI)
• FastAPI
• Validate server implementation with Dredd and
schemathesis
• Build API clients with mock servers
• Continuous Integration and deployment to Heroku
@JoseHaroPeralta
@microapisio
Repository for this presentation:
https://github.com/abunuwas/pycon-india-2021
7. Major causes of API
integration failures
• Backend-driven API development
• Misunderstandings about the API
• Lack of validation
8. Backend-driven design of the API
• The API server development team decides what the API looks like
• Popular approach in code-first approach
• Ends up in arbitrary API designs that are difficult to understand for the API client
development team
?
9. Misunderstandings drive API integration
failures
• Misunderstanding about data formats, e.g. "2021-07-29" vs "2021/07/29”
• Misunderstanding about data types, e.g. "2021" vs 2021 or true vs "True”
• Misunderstanding about optional fields
vs
12. What is API documentation?
REST -> OpenAPI
GraphQL -> Schema Definition
Language
gRPC -> Protobuf
13. What is
documentation-
driven
development?
• Also known as design-first, API-first
or contract-first approach
• Design and produce the API
specification first
• Build your server and your API
client (if you have one) against the
specification
• Use the specification to validate
your implementation
36. Links
• Microservice APIs in Python by J Haro (mng.bz/nz48)
• Building and deploying reliable APIs with FastAPI by J Haro
(https://www.twitch.tv/videos/1088283640)
• Documentation-driven development for APIs by J Haro
(https://link.medium.com/m2A3rOxUfib)
• Developing API clients doesn’t need to be a pain by J Haro
(https://link.medium.com/0B9vt7DUfib)
• Design patterns for modern web APIs by D Luecke
(https://blog.feathersjs.com/design-patterns-for-modern-web-apis-1f046635215)
• The design of web APIs by A Lauret (https://www.manning.com/books/the-
design-of-web-apis)
• API Design Patterns by JJ Geewax (https://www.manning.com/books/api-design-
patterns)