Don’t repeat yourself - Your
API is your Documentation
Michael Hibay, Baysong Services
Before we begin…
Have you seen docs like this?
What about this?
This one?
Or this one?
Maybe this one?
What is the goal of ..
• An API?
– Expose the resources, capabilities, and constraints of
a system to machines.
• Documentation?
– Expose the resources, capabilities, and constraints of
a system to people.
Notice anything?
API
Audience:	
Machines
Everything	
else.
Documentation
Audience:	
Humans
Everything	
else.
Don’t Repeat Yourself
• “If I have to do a task a third time, I will do ten
times more work to never do it again.”
A common agile dilemma
• Deliver complex new API for widgets.
– Design ➔ Implementation
– Design ➔ Documentation
– Documentation & Implementation ➔ Consumption
– All of the above ➔ Validation
• You have one week.
Silo + Redundancy = Problem
• Break up the silo and Problem = Redundancy
• How do we fix it?
– Stagger the work in multiple sprints.
– Overwork the team and risk burnout.
– Find out if we could remove the redundancy.
What if Design = Documentation?
Documentation
Implementation Validation Consumption
How can we remove the redundancy?
• Static Contract
– Open API Specification (OAS)
• Dynamic Profile
– Application Level Profile Semantics (ALPS)
• JSON-LD + Schema.org
– Hydra
Static Contract
• OAS
– Concise descriptive format with little redundancy
– Contract tightly couples consumers to servers, and
protocols
– High difficulty pushing changes to contract or
representations
Dynamic Profile
• ALPS + JSON Home + Hypermedia
• Unfamiliar design concept
• Underdeveloped tooling
• Difficulty Consuming
ALPS
• Application Level Profile Semantic (ALPS)
– Domain Model drives Interaction
– Externally bound to protocols
– Dynamic and cacheable
JSON Home
• Dynamically discover
– Resources
– Documentation
– Hints
Hypermedia Formats
• Siren
– Library support, tight HTML coupling, not finalized
• HAL
– Library and tooling support, format ambiguities exist
• {json:api}
– Library support, light on hypermedia tooling.
JSON-LD + Schema.org
• Static contexts and definitions created to graph.
• Embeddable and Interoperable.
• Verbose and Global.
• Resistant to change.
Hydra
• Adds vocabulary for hypermedia driven design.
• Simplifies implementation of JSON-LD.
• Fundamentally assumes creation and use of
perfect vocabularies
Key Questions
• Use these questions to narrow in on the best
option for you. Analyze with these properties in
mind.
– Desired service longevity
– Consumption audience
– Organizational processes and policies
How long will this API run ____?
• Between versions
• Between breaking changes
• Until EOL
Will this API be used outside ____?
• Our team
• Our organization
Will we ___ control the client ecosystem?
– Directly
– Indirectly
• How much of our resources do we want to
commit to supporting consumer agents?
Do we have barriers to interactive docs?
• Organizational Processes?
• Regulatory constraints?
• Confidentiality constraints?
Can we help improve standards?
• OAS
• Hypermedia
• _______
Thank you!
• Any questions?
Contacts
• @hibaymj
• Blog
• Github
• LinkedIn

LF_APIStrat17_Don't Repeat Yourself - Your API is Your Documentation

  • 2.
    Don’t repeat yourself- Your API is your Documentation Michael Hibay, Baysong Services
  • 3.
  • 4.
    Have you seendocs like this?
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
    What is thegoal of .. • An API? – Expose the resources, capabilities, and constraints of a system to machines. • Documentation? – Expose the resources, capabilities, and constraints of a system to people.
  • 10.
  • 11.
    Don’t Repeat Yourself •“If I have to do a task a third time, I will do ten times more work to never do it again.”
  • 12.
    A common agiledilemma • Deliver complex new API for widgets. – Design ➔ Implementation – Design ➔ Documentation – Documentation & Implementation ➔ Consumption – All of the above ➔ Validation • You have one week.
  • 13.
    Silo + Redundancy= Problem • Break up the silo and Problem = Redundancy • How do we fix it? – Stagger the work in multiple sprints. – Overwork the team and risk burnout. – Find out if we could remove the redundancy.
  • 14.
    What if Design= Documentation? Documentation Implementation Validation Consumption
  • 15.
    How can weremove the redundancy? • Static Contract – Open API Specification (OAS) • Dynamic Profile – Application Level Profile Semantics (ALPS) • JSON-LD + Schema.org – Hydra
  • 16.
    Static Contract • OAS –Concise descriptive format with little redundancy – Contract tightly couples consumers to servers, and protocols – High difficulty pushing changes to contract or representations
  • 17.
    Dynamic Profile • ALPS+ JSON Home + Hypermedia • Unfamiliar design concept • Underdeveloped tooling • Difficulty Consuming
  • 18.
    ALPS • Application LevelProfile Semantic (ALPS) – Domain Model drives Interaction – Externally bound to protocols – Dynamic and cacheable
  • 19.
    JSON Home • Dynamicallydiscover – Resources – Documentation – Hints
  • 20.
    Hypermedia Formats • Siren –Library support, tight HTML coupling, not finalized • HAL – Library and tooling support, format ambiguities exist • {json:api} – Library support, light on hypermedia tooling.
  • 21.
    JSON-LD + Schema.org •Static contexts and definitions created to graph. • Embeddable and Interoperable. • Verbose and Global. • Resistant to change.
  • 22.
    Hydra • Adds vocabularyfor hypermedia driven design. • Simplifies implementation of JSON-LD. • Fundamentally assumes creation and use of perfect vocabularies
  • 23.
    Key Questions • Usethese questions to narrow in on the best option for you. Analyze with these properties in mind. – Desired service longevity – Consumption audience – Organizational processes and policies
  • 24.
    How long willthis API run ____? • Between versions • Between breaking changes • Until EOL
  • 25.
    Will this APIbe used outside ____? • Our team • Our organization
  • 26.
    Will we ___control the client ecosystem? – Directly – Indirectly • How much of our resources do we want to commit to supporting consumer agents?
  • 27.
    Do we havebarriers to interactive docs? • Organizational Processes? • Regulatory constraints? • Confidentiality constraints?
  • 28.
    Can we helpimprove standards? • OAS • Hypermedia • _______
  • 29.
  • 30.