SlideShare a Scribd company logo
1 of 28
Effective API Design
Bansi Haudakari
API’s Are
For the Developers,
By The Developers
And
Of the Developers
- Bansi Haudakari
Who Am I?
• An API Developer
• An API Consumer
• An API Designer
• A Seasoned JAVA Programmer
who has been consuming JAVA
API’s since JDK 1.0 And Other
Open Source APIs For Software
Development
Agenda
• What is an API?
• Driving factors Of an API
• Principles of Effective API Design
• API Design Guidelines
• API Design In Action
• Value Of Great APIs
• Pitfalls of mediocre APIs
What is an API?
Application Programming Interface provides a
way for developers to interact with and consume a
service.
Analogy: Electrical Sockets
• APIs are gateways between Services and Consumers,
providing consumers access to services through various
interfaces
Example: Service : Electricity AND Consumer : Plug
• Our laptops, consumes electricity through a socket.
Through its own “API,” a USB socket, it can provide that
same electricity service to charge other devices.
Driving Factors
• Design of CHM
• Business Agility : Business Logic is exposed thru
APIs thereby enabling customers to focus on
innovations
• API Economy : Businesses are developing “API
products” as new sources of revenue. Expedia
generates over $2 billion thru data made
available through their API
• Internet of things: The number of things that
can be connected is growing fast; everything
from your coffee pot to your thermostat to
your car can now be accessed thru APIs
Principle 1 : Design First API
• With Design-First approach, focus is on
well-defined API spec’s instead of
implementation concerns.
• With an Design-First API approach, rather
than implementing an application and then
building API on top of it, first create the
interface and then put the back-end logic
into place - whether it be cloud-based or
on-premise.
• An optimal API design enables applications
developers to easily understand the
purpose and functionality of the API.
• It also allows organizations to focus on
getting API design right before investing in
back-end implementation,
• The best way to design an API that developers
want to use is to iteratively define the
structure of the API in an expressive manner
and get feedback from developers on its
usability and functionality
• As the API is designed, application developers
can interact with it and test its behavior,
thanks to an integrated mocking service that
returns the values a call to the live API would
produce.
• There is no such thing as a one-size-fits-all API
• An API should be optimized to fulfill a specific
business request in a specific context.
• Optimize API for a specific use case e.g.
– coarse or fine-grained
– constraints e.g. network trips, latency and data
size so API should be designed to limit backend
calls and minimize the size of data returned
API Design Guidelines
• Know the requirements
• Write use cases before you write any other
code
• Look for similar APIs in the same library
• Define the API before you implement it
otherwise it embodies the evils of
implementation-driven APIs i.e. don’t let
implementation considerations leak into the
API, apart in exceptional cases
API Design Guidelines
• Consider the perspective of the caller
• Make sure each method does only one thing
• Make all method calls atomic
• Limit the number of Mutator methods i.e.
set/get methods
• Favor generic methods over a set of overloaded
methods
• Avoid long-running methods
• Avoid forcing callers to write loops for basic
scenarios
API Design Guidelines
• Avoid “option” parameters to modify behavior
• Avoid non-reentrant methods
• Do not strengthen the precondition of an already released API
method
• Do not weaken the post condition of an already released API
method
• Do not add new methods to released interfaces
• Do not add a new overload to a released API
• Favor interfaces over concrete classes as return types
• Favor empty collections to null return values
• Consider making defensive copies of mutable parameters
• Consider storing weak object references internally
• Avoid parameter types exposing implementation details
API Design Guidelines
• Avoid returning references to mutable internal 
objects
• Consider a builder when faced with many 
constructor parameters
• Consider returning immutable collections from 
a getter
• Consider read-only properties
•  Document method preconditions
•  Document the performance characteristics of 
the algorithm implemented
Measure API Design
• Conceptual Complexity Measurement :
– double digit : use case is simple ;
– single digit : complex ;
– negative number : time to re-design
– In your code, Count the number of name constructs used in API
• try {
 AuthenticationProvider20 provider = new LocalAuthenticationProvider19();
SearchCriteria18 criteria = new SearchCriteria17(EntityName16.USER15);
criteria.addPropertyToFetch14(PropertyName13.COMMON_NAME12);
….
while(iterator.hasNext()4){
Profile3 profile = iterator.next()2;
Property1 commonName =
profile.getProperty0(PropertyName.COMMON_NAME); Property phone =
profile.getProperty(PropertyName.PHONE);
System.out.println(commonName.getValue()-1, “ ”, phone.getValue()); } }
catch(AuthenticationProviderException-2 e) { }
API Design In Action
Before After Design Rule
public long[]
getAllMessages() throws
MailboxException;
public abstract
SortedSet<T>
readAllMessageHeaders(
) throws
RemoteException,
MailboxException;
Favor collections over
arrays as parameters and
return values
Ensure no boilerplate
code is needed to
combine method calls
Reserve “get”, “set” and
“is” for JavaBeans
methods accessing local
fields
Throw checked
exceptions only for
recoverable errors
API Design In Action
Before After Design Rule
public void markRead(boolean
read, long[] ids) throws
MailboxException;
public abstract void
markRead(Collection<T>
headers) throws
NullPointerException,
RemoteException,
MailboxException;
Make all method calls atomic
 Avoid Boolean parameters
Ensure no boilerplate code is
needed to combine method
calls
Consider generic methods
Consider method pairs, where
the effect of one is reversed by
the other
Favor generic collections over
raw (untyped) collections
Throw NullPointerException to
indicate a prohibited null
parameter value
 Favor standard Java
exceptions over custom
exceptions
Principle 2 – Runtime API
• Once an API is designed, created and its back-
end implemented, it’s time to  find the right 
run-time as it affects How successful your API 
strategy will be in terms of service, liability, 
scale and ability to meet future needs.
• Hybrid support: As more and more businesses 
are moving to the cloud, so it is important to 
find runtime that allows to deploy applications 
both in the cloud as well as on-premise without 
having to modify anything.
• Scalability, reliability, availability: These “-ilities”, 
along with performance, are crucial when 
searching for a solid API runtime. The last thing 
you want is an unstable runtime that crashes or 
experiences outages. Choosing the right 
enterprise grade technology for your API runtime 
is crucial to the success of your API.
• Strong Orchestration: A successful runtime should 
provide strong orchestration and orchestration 
capabilities. The ability to carry out complex back-
end orchestration plays a key role in translation 
between the API layer and back-end 
implementation.
Principle 3 – API Design Contract
• API publishers should offer a way to easily 
create well-defined policies and contracts and 
associate them with the right APIs and 
consumers. 
• API Contracts are crucial for enforcing security 
and managing SLAs with API consumers.
• In addition, publish API version which helps in 
lifecycle management and allows API publishers 
to assess the impact of retiring a version. 
Example REST API’s
Principle 4 - Monitor API Usage
• The ability to monitor API usage over a period of
time and understand usage patterns from both
technical and business perspectives is valuable as
it helps business owners and technical teams
better understand their users and ultimately
create a better service.
• You need to see how consumers are using it i.e.
which parts of your service are being used.
• With metrics for both overall usage and per
consumer usage, businesses can closely monitor
API activity and engagement.
Principle 5 - Continuous Improvement
• The ability to re-factor your APIs by iterating
through habits 1-6 multiple times allows you to
optimize your API over time to improve
consumer experience and productivity.
• API is not a static entity – as new use cases are
identified and use of your API expands,
enhancements and fixes are inevitable.
Principle 6 -Socialize Your APIs
• Create a developer portal to establish a
community around your API is important to its
success. By making it easy for users to follow
your API, download documentation and ask
questions, API publishers can engage with API
consumers on an ongoing basis.
• Example create a developer portal for company-
wide REST services and document it using
Swagger
APIs Are Everywhere
Value of Great API’s
• Is a Product
• Help Grow a Eco-System of employees, customers
and Partners
• Evolve in a way that are mutually beneficial
• Encourage Adoption
• Ease Of Use
• Great APIs aren’t difficult to develop
– if you design for your users and the business processes
– if you make it easy for developers to find and consume
your API, and
– you actively manage your API developer community as
an extension of your business.
Pitfalls of a mediocre APIs
• Doesn’t engage Stake-holders
• limited adoption by developers and ultimately, a
failure to meet business objectives
• Starts with implementation first
• Design of API is dictated by the constraints of
internal systems or processes.
• Too often APIs are modeled after the design of the
backend services or applications they expose
instead of the use case they fulfill. This results in
poor performance of the client application, poor
user experience, and ultimately, poor adoption.
THANK YOU
Q & A

More Related Content

What's hot

OpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of SwaggerOpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of SwaggerSmartBear
 
API-first development
API-first developmentAPI-first development
API-first developmentVasco Veloso
 
OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)
OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)
OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)Open API Initiative (OAI)
 
Design First API's with RAML and SoapUI
Design First API's with RAML and SoapUIDesign First API's with RAML and SoapUI
Design First API's with RAML and SoapUIDaniel Feist
 
Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?Akana
 
Evaluating Recommended Applications
Evaluating Recommended ApplicationsEvaluating Recommended Applications
Evaluating Recommended Applicationsrsse2008
 
Why API? - Business of APIs Conference
Why API? - Business of APIs ConferenceWhy API? - Business of APIs Conference
Why API? - Business of APIs ConferenceDaniel Jacobson
 
Why your APIs should fly first class
Why your APIs should fly first classWhy your APIs should fly first class
Why your APIs should fly first classLibbySchulze
 
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...John Musser
 
A Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification LinksA Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification LinksTony Tam
 
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauretapidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauretapidays
 
API 101 - Understanding APIs
API 101 - Understanding APIsAPI 101 - Understanding APIs
API 101 - Understanding APIs3scale
 
Why vREST?
Why vREST?Why vREST?
Why vREST?vrest_io
 
I Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous CycleI Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous CycleApigee | Google Cloud
 

What's hot (17)

Mule api management
Mule  api managementMule  api management
Mule api management
 
OpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of SwaggerOpenAPI 3.0, And What It Means for the Future of Swagger
OpenAPI 3.0, And What It Means for the Future of Swagger
 
API-first development
API-first developmentAPI-first development
API-first development
 
OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)
OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)
OpenAPI Spec at Google (Open API Initiative Meetup on 2016-09-15)
 
Design First API's with RAML and SoapUI
Design First API's with RAML and SoapUIDesign First API's with RAML and SoapUI
Design First API's with RAML and SoapUI
 
Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?
 
Evaluating Recommended Applications
Evaluating Recommended ApplicationsEvaluating Recommended Applications
Evaluating Recommended Applications
 
Why API? - Business of APIs Conference
Why API? - Business of APIs ConferenceWhy API? - Business of APIs Conference
Why API? - Business of APIs Conference
 
Why your APIs should fly first class
Why your APIs should fly first classWhy your APIs should fly first class
Why your APIs should fly first class
 
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
KPIs for APIs (and how API Calls are the new Web Hits, and you may be measuri...
 
Huge: Running an API at Scale
Huge: Running an API at ScaleHuge: Running an API at Scale
Huge: Running an API at Scale
 
How to define an api
How to define an apiHow to define an api
How to define an api
 
A Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification LinksA Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification Links
 
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauretapidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
apidays LIVE Paris - The Augmented API Design Reviewer by Arnaud Lauret
 
API 101 - Understanding APIs
API 101 - Understanding APIsAPI 101 - Understanding APIs
API 101 - Understanding APIs
 
Why vREST?
Why vREST?Why vREST?
Why vREST?
 
I Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous CycleI Love APIs 2015: Continuous Integration the Virtuous Cycle
I Love APIs 2015: Continuous Integration the Virtuous Cycle
 

Viewers also liked

class_desriptions
class_desriptionsclass_desriptions
class_desriptionsIsaac Long
 
ProspectusPresentationPrinterFriendly
ProspectusPresentationPrinterFriendlyProspectusPresentationPrinterFriendly
ProspectusPresentationPrinterFriendlymartijnetje
 
Advantages In Registration Of Llp In India
Advantages In Registration Of Llp In IndiaAdvantages In Registration Of Llp In India
Advantages In Registration Of Llp In IndiaStartupwala
 
Nfais Presentation20080226 F
Nfais Presentation20080226 FNfais Presentation20080226 F
Nfais Presentation20080226 Frotciv
 
บริการต่างๆบนอินเตอร์เน็ต.
บริการต่างๆบนอินเตอร์เน็ต.บริการต่างๆบนอินเตอร์เน็ต.
บริการต่างๆบนอินเตอร์เน็ต.na12890
 
Procedure in incorporation of llp in nagpur
Procedure in incorporation of llp in nagpurProcedure in incorporation of llp in nagpur
Procedure in incorporation of llp in nagpurBala Nadar
 
Murad camarad wysinger c.d.pt.1 html files.doc
Murad camarad wysinger c.d.pt.1 html files.docMurad camarad wysinger c.d.pt.1 html files.doc
Murad camarad wysinger c.d.pt.1 html files.docAztanahmian
 
NLP approach for medical translation task
NLP approach for medical translation taskNLP approach for medical translation task
NLP approach for medical translation taskAnastasiia Kornilova
 
Presentation on switchgear
Presentation on switchgear Presentation on switchgear
Presentation on switchgear Shubham Nagarale
 
Doctor of philosophy updated 2014
Doctor of philosophy updated 2014Doctor of philosophy updated 2014
Doctor of philosophy updated 2014Adhy Ramones
 
How to Use Algorithms to Scale Digital Business
How to Use Algorithms to Scale Digital BusinessHow to Use Algorithms to Scale Digital Business
How to Use Algorithms to Scale Digital BusinessTeradata
 
Query Understanding: A Manifesto
Query Understanding: A ManifestoQuery Understanding: A Manifesto
Query Understanding: A ManifestoDaniel Tunkelang
 

Viewers also liked (20)

Water Master Plan Update
Water Master Plan UpdateWater Master Plan Update
Water Master Plan Update
 
05 Conflict Management Strategies
05 Conflict Management Strategies05 Conflict Management Strategies
05 Conflict Management Strategies
 
class_desriptions
class_desriptionsclass_desriptions
class_desriptions
 
Resumen Curso Elisava
Resumen Curso ElisavaResumen Curso Elisava
Resumen Curso Elisava
 
ProspectusPresentationPrinterFriendly
ProspectusPresentationPrinterFriendlyProspectusPresentationPrinterFriendly
ProspectusPresentationPrinterFriendly
 
Clonación cell stem
Clonación cell stemClonación cell stem
Clonación cell stem
 
Advantages In Registration Of Llp In India
Advantages In Registration Of Llp In IndiaAdvantages In Registration Of Llp In India
Advantages In Registration Of Llp In India
 
Nfais Presentation20080226 F
Nfais Presentation20080226 FNfais Presentation20080226 F
Nfais Presentation20080226 F
 
Flyer by Angela's group
Flyer by Angela's groupFlyer by Angela's group
Flyer by Angela's group
 
บริการต่างๆบนอินเตอร์เน็ต.
บริการต่างๆบนอินเตอร์เน็ต.บริการต่างๆบนอินเตอร์เน็ต.
บริการต่างๆบนอินเตอร์เน็ต.
 
Procedure in incorporation of llp in nagpur
Procedure in incorporation of llp in nagpurProcedure in incorporation of llp in nagpur
Procedure in incorporation of llp in nagpur
 
5 testimonianze
5 testimonianze5 testimonianze
5 testimonianze
 
Murad camarad wysinger c.d.pt.1 html files.doc
Murad camarad wysinger c.d.pt.1 html files.docMurad camarad wysinger c.d.pt.1 html files.doc
Murad camarad wysinger c.d.pt.1 html files.doc
 
Tema 14 lengua
Tema 14 lenguaTema 14 lengua
Tema 14 lengua
 
NLP approach for medical translation task
NLP approach for medical translation taskNLP approach for medical translation task
NLP approach for medical translation task
 
Presentation on switchgear
Presentation on switchgear Presentation on switchgear
Presentation on switchgear
 
Doctor of philosophy updated 2014
Doctor of philosophy updated 2014Doctor of philosophy updated 2014
Doctor of philosophy updated 2014
 
How to Use Algorithms to Scale Digital Business
How to Use Algorithms to Scale Digital BusinessHow to Use Algorithms to Scale Digital Business
How to Use Algorithms to Scale Digital Business
 
Query Understanding: A Manifesto
Query Understanding: A ManifestoQuery Understanding: A Manifesto
Query Understanding: A Manifesto
 
La salud
La saludLa salud
La salud
 

Similar to How to design effective APIs

Recipes for API Ninjas
Recipes for API NinjasRecipes for API Ninjas
Recipes for API NinjasNordic APIs
 
Practical Application of API-First in microservices development
Practical Application of API-First in microservices developmentPractical Application of API-First in microservices development
Practical Application of API-First in microservices developmentChavdar Baikov
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Dependency Down, Flexibility Up – The Benefits of API-First Development
Dependency Down, Flexibility Up – The Benefits of API-First DevelopmentDependency Down, Flexibility Up – The Benefits of API-First Development
Dependency Down, Flexibility Up – The Benefits of API-First DevelopmentNordic APIs
 
Extend soa with api management Sangam18
Extend soa with api management Sangam18Extend soa with api management Sangam18
Extend soa with api management Sangam18Vinay Kumar
 
Service api design validation & collaboration
Service api design validation & collaborationService api design validation & collaboration
Service api design validation & collaborationUchit Vyas ☁
 
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMGapidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMGapidays
 
Extend soa with api management spoug- Madrid
Extend soa with api management   spoug- MadridExtend soa with api management   spoug- Madrid
Extend soa with api management spoug- MadridVinay Kumar
 
Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxapidays
 
API Management Building Blocks and Business value
API Management   Building Blocks and Business valueAPI Management   Building Blocks and Business value
API Management Building Blocks and Business valueWSO2
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays
 
Extend soa with api management Doag18
Extend soa with api management Doag18Extend soa with api management Doag18
Extend soa with api management Doag18Vinay Kumar
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for LongevityMuleSoft
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile appsMugunth Kumar
 
API Strategy Introduction
API Strategy IntroductionAPI Strategy Introduction
API Strategy IntroductionDoug Gregory
 
Pain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re EverywherePain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re EverywhereNordic APIs
 
APIs In Action -Harnessing the Power of Azure API Management: Building Robust...
APIs In Action -Harnessing the Power of Azure API Management: Building Robust...APIs In Action -Harnessing the Power of Azure API Management: Building Robust...
APIs In Action -Harnessing the Power of Azure API Management: Building Robust...Hamida Rebai Trabelsi
 

Similar to How to design effective APIs (20)

Effective API Design
Effective API DesignEffective API Design
Effective API Design
 
Recipes for API Ninjas
Recipes for API NinjasRecipes for API Ninjas
Recipes for API Ninjas
 
Practical Application of API-First in microservices development
Practical Application of API-First in microservices developmentPractical Application of API-First in microservices development
Practical Application of API-First in microservices development
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Dependency Down, Flexibility Up – The Benefits of API-First Development
Dependency Down, Flexibility Up – The Benefits of API-First DevelopmentDependency Down, Flexibility Up – The Benefits of API-First Development
Dependency Down, Flexibility Up – The Benefits of API-First Development
 
Extend soa with api management Sangam18
Extend soa with api management Sangam18Extend soa with api management Sangam18
Extend soa with api management Sangam18
 
Api manager
Api managerApi manager
Api manager
 
Service api design validation & collaboration
Service api design validation & collaborationService api design validation & collaboration
Service api design validation & collaboration
 
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMGapidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
apidays LIVE New York 2021 - Service API design validation by Uchit Vyas, KPMG
 
Extend soa with api management spoug- Madrid
Extend soa with api management   spoug- MadridExtend soa with api management   spoug- Madrid
Extend soa with api management spoug- Madrid
 
Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptx
 
API Management Building Blocks and Business value
API Management   Building Blocks and Business valueAPI Management   Building Blocks and Business value
API Management Building Blocks and Business value
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
 
Open Banking & Open Insurance
Open Banking & Open InsuranceOpen Banking & Open Insurance
Open Banking & Open Insurance
 
Extend soa with api management Doag18
Extend soa with api management Doag18Extend soa with api management Doag18
Extend soa with api management Doag18
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for Longevity
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
 
API Strategy Introduction
API Strategy IntroductionAPI Strategy Introduction
API Strategy Introduction
 
Pain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re EverywherePain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re Everywhere
 
APIs In Action -Harnessing the Power of Azure API Management: Building Robust...
APIs In Action -Harnessing the Power of Azure API Management: Building Robust...APIs In Action -Harnessing the Power of Azure API Management: Building Robust...
APIs In Action -Harnessing the Power of Azure API Management: Building Robust...
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

How to design effective APIs

  • 2. API’s Are For the Developers, By The Developers And Of the Developers - Bansi Haudakari
  • 3. Who Am I? • An API Developer • An API Consumer • An API Designer • A Seasoned JAVA Programmer who has been consuming JAVA API’s since JDK 1.0 And Other Open Source APIs For Software Development
  • 4. Agenda • What is an API? • Driving factors Of an API • Principles of Effective API Design • API Design Guidelines • API Design In Action • Value Of Great APIs • Pitfalls of mediocre APIs
  • 5. What is an API? Application Programming Interface provides a way for developers to interact with and consume a service.
  • 6. Analogy: Electrical Sockets • APIs are gateways between Services and Consumers, providing consumers access to services through various interfaces Example: Service : Electricity AND Consumer : Plug • Our laptops, consumes electricity through a socket. Through its own “API,” a USB socket, it can provide that same electricity service to charge other devices.
  • 7. Driving Factors • Design of CHM • Business Agility : Business Logic is exposed thru APIs thereby enabling customers to focus on innovations • API Economy : Businesses are developing “API products” as new sources of revenue. Expedia generates over $2 billion thru data made available through their API • Internet of things: The number of things that can be connected is growing fast; everything from your coffee pot to your thermostat to your car can now be accessed thru APIs
  • 8. Principle 1 : Design First API • With Design-First approach, focus is on well-defined API spec’s instead of implementation concerns.
  • 9. • With an Design-First API approach, rather than implementing an application and then building API on top of it, first create the interface and then put the back-end logic into place - whether it be cloud-based or on-premise. • An optimal API design enables applications developers to easily understand the purpose and functionality of the API. • It also allows organizations to focus on getting API design right before investing in back-end implementation,
  • 10. • The best way to design an API that developers want to use is to iteratively define the structure of the API in an expressive manner and get feedback from developers on its usability and functionality • As the API is designed, application developers can interact with it and test its behavior, thanks to an integrated mocking service that returns the values a call to the live API would produce.
  • 11. • There is no such thing as a one-size-fits-all API • An API should be optimized to fulfill a specific business request in a specific context. • Optimize API for a specific use case e.g. – coarse or fine-grained – constraints e.g. network trips, latency and data size so API should be designed to limit backend calls and minimize the size of data returned
  • 12. API Design Guidelines • Know the requirements • Write use cases before you write any other code • Look for similar APIs in the same library • Define the API before you implement it otherwise it embodies the evils of implementation-driven APIs i.e. don’t let implementation considerations leak into the API, apart in exceptional cases
  • 13. API Design Guidelines • Consider the perspective of the caller • Make sure each method does only one thing • Make all method calls atomic • Limit the number of Mutator methods i.e. set/get methods • Favor generic methods over a set of overloaded methods • Avoid long-running methods • Avoid forcing callers to write loops for basic scenarios
  • 14. API Design Guidelines • Avoid “option” parameters to modify behavior • Avoid non-reentrant methods • Do not strengthen the precondition of an already released API method • Do not weaken the post condition of an already released API method • Do not add new methods to released interfaces • Do not add a new overload to a released API • Favor interfaces over concrete classes as return types • Favor empty collections to null return values • Consider making defensive copies of mutable parameters • Consider storing weak object references internally • Avoid parameter types exposing implementation details
  • 15. API Design Guidelines • Avoid returning references to mutable internal  objects • Consider a builder when faced with many  constructor parameters • Consider returning immutable collections from  a getter • Consider read-only properties •  Document method preconditions •  Document the performance characteristics of  the algorithm implemented
  • 16. Measure API Design • Conceptual Complexity Measurement : – double digit : use case is simple ; – single digit : complex ; – negative number : time to re-design – In your code, Count the number of name constructs used in API • try {  AuthenticationProvider20 provider = new LocalAuthenticationProvider19(); SearchCriteria18 criteria = new SearchCriteria17(EntityName16.USER15); criteria.addPropertyToFetch14(PropertyName13.COMMON_NAME12); …. while(iterator.hasNext()4){ Profile3 profile = iterator.next()2; Property1 commonName = profile.getProperty0(PropertyName.COMMON_NAME); Property phone = profile.getProperty(PropertyName.PHONE); System.out.println(commonName.getValue()-1, “ ”, phone.getValue()); } } catch(AuthenticationProviderException-2 e) { }
  • 17. API Design In Action Before After Design Rule public long[] getAllMessages() throws MailboxException; public abstract SortedSet<T> readAllMessageHeaders( ) throws RemoteException, MailboxException; Favor collections over arrays as parameters and return values Ensure no boilerplate code is needed to combine method calls Reserve “get”, “set” and “is” for JavaBeans methods accessing local fields Throw checked exceptions only for recoverable errors
  • 18. API Design In Action Before After Design Rule public void markRead(boolean read, long[] ids) throws MailboxException; public abstract void markRead(Collection<T> headers) throws NullPointerException, RemoteException, MailboxException; Make all method calls atomic  Avoid Boolean parameters Ensure no boilerplate code is needed to combine method calls Consider generic methods Consider method pairs, where the effect of one is reversed by the other Favor generic collections over raw (untyped) collections Throw NullPointerException to indicate a prohibited null parameter value  Favor standard Java exceptions over custom exceptions
  • 19. Principle 2 – Runtime API • Once an API is designed, created and its back- end implemented, it’s time to  find the right  run-time as it affects How successful your API  strategy will be in terms of service, liability,  scale and ability to meet future needs. • Hybrid support: As more and more businesses  are moving to the cloud, so it is important to  find runtime that allows to deploy applications  both in the cloud as well as on-premise without  having to modify anything.
  • 20. • Scalability, reliability, availability: These “-ilities”,  along with performance, are crucial when  searching for a solid API runtime. The last thing  you want is an unstable runtime that crashes or  experiences outages. Choosing the right  enterprise grade technology for your API runtime  is crucial to the success of your API. • Strong Orchestration: A successful runtime should  provide strong orchestration and orchestration  capabilities. The ability to carry out complex back- end orchestration plays a key role in translation  between the API layer and back-end  implementation.
  • 21. Principle 3 – API Design Contract • API publishers should offer a way to easily  create well-defined policies and contracts and  associate them with the right APIs and  consumers.  • API Contracts are crucial for enforcing security  and managing SLAs with API consumers. • In addition, publish API version which helps in  lifecycle management and allows API publishers  to assess the impact of retiring a version.  Example REST API’s
  • 22. Principle 4 - Monitor API Usage • The ability to monitor API usage over a period of time and understand usage patterns from both technical and business perspectives is valuable as it helps business owners and technical teams better understand their users and ultimately create a better service. • You need to see how consumers are using it i.e. which parts of your service are being used. • With metrics for both overall usage and per consumer usage, businesses can closely monitor API activity and engagement.
  • 23. Principle 5 - Continuous Improvement • The ability to re-factor your APIs by iterating through habits 1-6 multiple times allows you to optimize your API over time to improve consumer experience and productivity. • API is not a static entity – as new use cases are identified and use of your API expands, enhancements and fixes are inevitable.
  • 24. Principle 6 -Socialize Your APIs • Create a developer portal to establish a community around your API is important to its success. By making it easy for users to follow your API, download documentation and ask questions, API publishers can engage with API consumers on an ongoing basis. • Example create a developer portal for company- wide REST services and document it using Swagger
  • 26. Value of Great API’s • Is a Product • Help Grow a Eco-System of employees, customers and Partners • Evolve in a way that are mutually beneficial • Encourage Adoption • Ease Of Use • Great APIs aren’t difficult to develop – if you design for your users and the business processes – if you make it easy for developers to find and consume your API, and – you actively manage your API developer community as an extension of your business.
  • 27. Pitfalls of a mediocre APIs • Doesn’t engage Stake-holders • limited adoption by developers and ultimately, a failure to meet business objectives • Starts with implementation first • Design of API is dictated by the constraints of internal systems or processes. • Too often APIs are modeled after the design of the backend services or applications they expose instead of the use case they fulfill. This results in poor performance of the client application, poor user experience, and ultimately, poor adoption.

Editor's Notes

  1. The ability to develop applications once and deploy them in the cloud or on-premise provides a host of possibilities without complexity