SlideShare a Scribd company logo
1 of 38
Download to read offline
© 2014 - Proprietary and Confidential Information of FINCAD
An example-based approach
(by Lois Patterson)
Creating Good API
Documentation
© 2014 - Proprietary and Confidential Information of FINCAD
Why APIs and API Documentation
Matters
● Explosive growth in APIs: everyone wants
them (maybe 200K in 2014?)
● Amazon’s success linked to API-based
approach
● Lego-based approach to software
development--natural evolution of object-
orientation
© 2014 - Proprietary and Confidential Information of FINCAD
Vast world of APIs
• ProgrammableWeb.com - tens of thousands
of APIs, mashups
• APIs for:
• Burning Man
• Birdsongs
• Facial recognition
• ?
© 2014 - Proprietary and Confidential Information of FINCAD
Not just developers
You know how to use APIs
Do you ever embed YouTube videos in your
blog?
<iframe width="560" height="315"
src="//www.youtube.com/embed/LJr6FknZhpM
" frameborder="0" allowfullscreen></iframe>
YouTube provides that code with Share.
© 2014 - Proprietary and Confidential Information of FINCAD
YouTube Embed Code
© 2014 - Proprietary and Confidential Information of FINCAD
API to embed video (2)
© 2014 - Proprietary and Confidential Information of FINCAD
Why API docs matter
• Without documentation, an API is almost
completely inaccessible.
• For a determined hacker, perhaps possible.
• For the regular user without docs, disaster.
• API docs make the API product possible,
much more so than for GUI software.
• Developers do RTFM (read the … manual) for
APIs.
© 2014 - Proprietary and Confidential Information of FINCAD
Good APIs good API docs
• Start with a good API to make good API docs
• Consistency!
© 2014 - Proprietary and Confidential Information of FINCAD
REST APIs in a Nutshell
• Verbs (GET, POST, PUT, DELETE -- maybe PATCH, but it is
controversial)
• Nouns (Also called objects or resources)
• Apply verbs to nouns
• Simple and intuitive? For example:
o Get a movie_ID
o Post (create) a person_ID
o Put (edit by replacing) a rating_ID
o Delete an entry_ID (from a queue)
© 2014 - Proprietary and Confidential Information of FINCAD
CRUD principle
• CRUD (Create/Read/Update/Delete)
• But what you create, what you select to
read or update or delete, is not
necessarily simple
© 2014 - Proprietary and Confidential Information of FINCAD
Example: API Consistency and Use
Cases in Netflix
Endpoint for a movie title, by title ID:
http://api-public.netflix.com/catalog/titles/movies/title_id
Endpoint for a TV program, by program ID:
http://api-
public.netflix.com/catalog/titles/programs/program_id
Endpoint for a person, by person ID:
http://api-public.netflix.com/catalog/people/person_id
© 2014 - Proprietary and Confidential Information of FINCAD
How about PayPal?
© 2014 - Proprietary and Confidential Information of FINCAD
Some RESTful APIs with great docs
● Netflix
● Twitter
● Github
● Facebook
● PayPal
● Flickr
● Google
© 2014 - Proprietary and Confidential Information of FINCAD
Why are these good APIs?
Netflix - Just a well-done API (sadly, it has not
been updated and no publicly available keys
anymore)
Twitter - Really clear definition of objects and
what you can do with them
Github - Simple and everything is there
© 2014 - Proprietary and Confidential Information of FINCAD
How do I help make a good API?
● Be involved in the beginning.
● Read design documents (they exist, right?)
● If no design document, can you write it?
● Try writing some sample documentation for
this fledgling API – doc first?
● Best is if QA, Documentation, Development
(not to mention Product Management) are
together in the design phase
© 2014 - Proprietary and Confidential Information of FINCAD
Important features of a good API
● Consistency
● Good error messages
● Clear naming conventions
● Just like for any other software product!
© 2014 - Proprietary and Confidential Information of FINCAD
API standards?
● Very popular APIs tend to become de facto
standards
● Standards include: REST, RPC, etc.
● REST is probably winning the day
© 2014 - Proprietary and Confidential Information of FINCAD
Can your API be as easy as
YouTube?
● Yes! For at least a few features.
● YouTube includes more complicated features:
https://developers.google.com/youtube/
● A lot of work to get something that simple
● Typical Twitter program (Python) to get a
mass of tweets and save them to a file using
the RESTful API: about 35 lines
If you want mass-market adoption, simplicity is
paramount.
© 2014 - Proprietary and Confidential Information of FINCAD
API Demonstration and Testing
Tools
• Swagger (Django REST Swagger)
• Atlassian REST browser
• Google Advanced REST client
• cURL
Show AND Tell with these tools.
May need developer help—this is for
everyone’s benefit!
© 2014 - Proprietary and Confidential Information of FINCAD
Pet Store Swagger
© 2014 - Proprietary and Confidential Information of FINCAD
Pet Store Swagger
© 2014 - Proprietary and Confidential Information of FINCAD
Model in Swagger
© 2014 - Proprietary and Confidential Information of FINCAD
Model
© 2014 - Proprietary and Confidential Information of FINCAD
What goes in the POST box?
{
"name":"Naive Cash Discounting USD",
"format":"f3ml",
"definition":
"<f><n>ExtendModelWithBootstrappedInterpolationCurve</n><a><p><n>AutoSort</n><v><r>
<b>F</b></r></v></p>
<p><n>BaseModel</n><v><r><s>${-
1}</s></r></v></p><p><n>BootstrappingObjective</n><v><r><s>SingleCurrencyValue</s><
/r></v></p>
<p><n>CurveTag</n><v><r><s>USD</s><s>DiscountCurve</s></r></v></p><p><n>Inter
polationMethod</n><v><r><s>LogLinear</s></r></v></p>
<p><n>MarketDataTag</n><v><r><s>CashDeposit:USD</s><s>CashDepo</s></r></v></p
><p><n>ModelName</n><v><r><s></s></r></v></p></a></f>"
}
© 2014 - Proprietary and Confidential Information of FINCAD
Model by slug
© 2014 - Proprietary and Confidential Information of FINCAD
Flickr API Garden
Look what you can do:
https://www.flickr.com/services/api/explore/?method=flickr.photos.search
© 2014 - Proprietary and Confidential Information of FINCAD
PayPal test environment
PayPal
https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/
© 2014 - Proprietary and Confidential Information of FINCAD
API docs should include …
• Description
• Tutorials
• Examples (Snippets, working apps)
• Sandbox test environment
• FAQs
© 2014 - Proprietary and Confidential Information of FINCAD
Your API docs should have …
● Clear versioning. (And when coding, use
version number of the API.)
● Last-verified date, particularly for Web apps.
● FAQ
● Working code samples
● Suggestions for using API
© 2014 - Proprietary and Confidential Information of FINCAD
Twitter helps the API user
Twitter site:
There are a few great ways to follow the changes we make to
the Twitter platform:
• Follow @twitterapi.
• Keep track of our Developer Blog and Discussions.
• See the recently updated documentation.
• Consult the Platform Calendar.
© 2014 - Proprietary and Confidential Information of FINCAD
Backlinks
Twitter
© 2014 - Proprietary and Confidential Information of FINCAD
Twitter API doc page
© 2014 - Proprietary and Confidential Information of FINCAD
How do I get code samples?
• Laziness! I encourage it!
• Developers have created samples for tests (or
they should!)
• Quality Assurance has created samples for
tests
• Take these samples
• Agree on a standard style
• Build more based on these samples
© 2014 - Proprietary and Confidential Information of FINCAD
Do I need to code?
• Empathy with our users is a core requirement
for a tech writer
• Learn to read and edit code
• Increase your code-creation abilities
• Coursera, Udacity, Khan Academy, etc.
• Use support groups
• All code samples are documentation; not all
documentation is code.
© 2014 - Proprietary and Confidential Information of FINCAD
API Tutorial to try
Sarah Maddox, previously of Atlassian and now
of Google, wrote this tutorial:
http://ffeathers.wordpress.com/2014/09/28/wa
nt-a-rest-api-to-play-with/
Learn about code, docs, API design in one go!
© 2014 - Proprietary and Confidential Information of FINCAD
Resources
http://jacobian.org/writing/what-to-write/
http://www.theparticlelab.com/good-api-documentation/
http://ffeathers.wordpress.com/
http://www.idratherbewriting.com/
http://www.programmableweb.com/
https://helloreverb.com/developers/swagger
http://stackoverflow.com/questions/2001899/creating-great-api-documentation-tools-and-techniques
http://stackoverflow.com/questions/1515326/what-do-you-consider-good-api-documentation
https://www.youtube.com/watch?v=C5ws9ZNUfxc
http://www.apiacademy.co
http://apievangelist.com/2014/09/20/my-api-101-workshop-at-apistrat-in-chicago-next-week
and more!
© 2014 - Proprietary and Confidential Information of FINCAD
© 2014 - Proprietary and Confidential Information of FINCAD
L.Patterson@fincad.com
@LoisRP

More Related Content

More from soapconf

Anton Bollen - What Makes a Video Effective?; soap! 2015
Anton Bollen - What Makes a Video Effective?; soap! 2015Anton Bollen - What Makes a Video Effective?; soap! 2015
Anton Bollen - What Makes a Video Effective?; soap! 2015soapconf
 
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...soapconf
 
Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015
Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015
Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015soapconf
 
Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014
Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014
Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014soapconf
 
Ray Gallon - Your most important business asset - Build a better end-to-end c...
Ray Gallon - Your most important business asset - Build a better end-to-end c...Ray Gallon - Your most important business asset - Build a better end-to-end c...
Ray Gallon - Your most important business asset - Build a better end-to-end c...soapconf
 
Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...
Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...
Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...soapconf
 
Kasia Mrowca - How to defeat feature gluttony; soapconf 2014
Kasia Mrowca - How to defeat feature gluttony; soapconf 2014Kasia Mrowca - How to defeat feature gluttony; soapconf 2014
Kasia Mrowca - How to defeat feature gluttony; soapconf 2014soapconf
 
Noz Urbina - Messages for your manager about content; soapconf 2014
Noz Urbina - Messages for your manager about content; soapconf 2014Noz Urbina - Messages for your manager about content; soapconf 2014
Noz Urbina - Messages for your manager about content; soapconf 2014soapconf
 
Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014
Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014
Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014soapconf
 
Monika Konieczny - Gamification & storytelling: how to turn boring technical ...
Monika Konieczny - Gamification & storytelling: how to turn boring technical ...Monika Konieczny - Gamification & storytelling: how to turn boring technical ...
Monika Konieczny - Gamification & storytelling: how to turn boring technical ...soapconf
 
Kevin Duncan - Speaking the visual language using images for effective commun...
Kevin Duncan - Speaking the visual language using images for effective commun...Kevin Duncan - Speaking the visual language using images for effective commun...
Kevin Duncan - Speaking the visual language using images for effective commun...soapconf
 

More from soapconf (11)

Anton Bollen - What Makes a Video Effective?; soap! 2015
Anton Bollen - What Makes a Video Effective?; soap! 2015Anton Bollen - What Makes a Video Effective?; soap! 2015
Anton Bollen - What Makes a Video Effective?; soap! 2015
 
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...
 
Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015
Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015
Ray Gallon - Complexity, Nemetics, and Wicked Tech Comm; soap! 2015
 
Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014
Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014
Rick Yagodich - Onramp: Making the case for author experience; soapconf 2014
 
Ray Gallon - Your most important business asset - Build a better end-to-end c...
Ray Gallon - Your most important business asset - Build a better end-to-end c...Ray Gallon - Your most important business asset - Build a better end-to-end c...
Ray Gallon - Your most important business asset - Build a better end-to-end c...
 
Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...
Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...
Felix Sasaki - Value beyond content creation - Introducing ITS 2.0; soapconf ...
 
Kasia Mrowca - How to defeat feature gluttony; soapconf 2014
Kasia Mrowca - How to defeat feature gluttony; soapconf 2014Kasia Mrowca - How to defeat feature gluttony; soapconf 2014
Kasia Mrowca - How to defeat feature gluttony; soapconf 2014
 
Noz Urbina - Messages for your manager about content; soapconf 2014
Noz Urbina - Messages for your manager about content; soapconf 2014Noz Urbina - Messages for your manager about content; soapconf 2014
Noz Urbina - Messages for your manager about content; soapconf 2014
 
Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014
Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014
Agnieszka Tkaczyk - Using infographics in technical communication; soapconf 2014
 
Monika Konieczny - Gamification & storytelling: how to turn boring technical ...
Monika Konieczny - Gamification & storytelling: how to turn boring technical ...Monika Konieczny - Gamification & storytelling: how to turn boring technical ...
Monika Konieczny - Gamification & storytelling: how to turn boring technical ...
 
Kevin Duncan - Speaking the visual language using images for effective commun...
Kevin Duncan - Speaking the visual language using images for effective commun...Kevin Duncan - Speaking the visual language using images for effective commun...
Kevin Duncan - Speaking the visual language using images for effective commun...
 

Recently uploaded

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Lois Patterson - Learning how to document APIs by example; soapconf 2014

  • 1. © 2014 - Proprietary and Confidential Information of FINCAD An example-based approach (by Lois Patterson) Creating Good API Documentation
  • 2. © 2014 - Proprietary and Confidential Information of FINCAD Why APIs and API Documentation Matters ● Explosive growth in APIs: everyone wants them (maybe 200K in 2014?) ● Amazon’s success linked to API-based approach ● Lego-based approach to software development--natural evolution of object- orientation
  • 3. © 2014 - Proprietary and Confidential Information of FINCAD Vast world of APIs • ProgrammableWeb.com - tens of thousands of APIs, mashups • APIs for: • Burning Man • Birdsongs • Facial recognition • ?
  • 4. © 2014 - Proprietary and Confidential Information of FINCAD Not just developers You know how to use APIs Do you ever embed YouTube videos in your blog? <iframe width="560" height="315" src="//www.youtube.com/embed/LJr6FknZhpM " frameborder="0" allowfullscreen></iframe> YouTube provides that code with Share.
  • 5. © 2014 - Proprietary and Confidential Information of FINCAD YouTube Embed Code
  • 6. © 2014 - Proprietary and Confidential Information of FINCAD API to embed video (2)
  • 7. © 2014 - Proprietary and Confidential Information of FINCAD Why API docs matter • Without documentation, an API is almost completely inaccessible. • For a determined hacker, perhaps possible. • For the regular user without docs, disaster. • API docs make the API product possible, much more so than for GUI software. • Developers do RTFM (read the … manual) for APIs.
  • 8. © 2014 - Proprietary and Confidential Information of FINCAD Good APIs good API docs • Start with a good API to make good API docs • Consistency!
  • 9. © 2014 - Proprietary and Confidential Information of FINCAD REST APIs in a Nutshell • Verbs (GET, POST, PUT, DELETE -- maybe PATCH, but it is controversial) • Nouns (Also called objects or resources) • Apply verbs to nouns • Simple and intuitive? For example: o Get a movie_ID o Post (create) a person_ID o Put (edit by replacing) a rating_ID o Delete an entry_ID (from a queue)
  • 10. © 2014 - Proprietary and Confidential Information of FINCAD CRUD principle • CRUD (Create/Read/Update/Delete) • But what you create, what you select to read or update or delete, is not necessarily simple
  • 11. © 2014 - Proprietary and Confidential Information of FINCAD Example: API Consistency and Use Cases in Netflix Endpoint for a movie title, by title ID: http://api-public.netflix.com/catalog/titles/movies/title_id Endpoint for a TV program, by program ID: http://api- public.netflix.com/catalog/titles/programs/program_id Endpoint for a person, by person ID: http://api-public.netflix.com/catalog/people/person_id
  • 12. © 2014 - Proprietary and Confidential Information of FINCAD How about PayPal?
  • 13. © 2014 - Proprietary and Confidential Information of FINCAD Some RESTful APIs with great docs ● Netflix ● Twitter ● Github ● Facebook ● PayPal ● Flickr ● Google
  • 14. © 2014 - Proprietary and Confidential Information of FINCAD Why are these good APIs? Netflix - Just a well-done API (sadly, it has not been updated and no publicly available keys anymore) Twitter - Really clear definition of objects and what you can do with them Github - Simple and everything is there
  • 15. © 2014 - Proprietary and Confidential Information of FINCAD How do I help make a good API? ● Be involved in the beginning. ● Read design documents (they exist, right?) ● If no design document, can you write it? ● Try writing some sample documentation for this fledgling API – doc first? ● Best is if QA, Documentation, Development (not to mention Product Management) are together in the design phase
  • 16. © 2014 - Proprietary and Confidential Information of FINCAD Important features of a good API ● Consistency ● Good error messages ● Clear naming conventions ● Just like for any other software product!
  • 17. © 2014 - Proprietary and Confidential Information of FINCAD API standards? ● Very popular APIs tend to become de facto standards ● Standards include: REST, RPC, etc. ● REST is probably winning the day
  • 18. © 2014 - Proprietary and Confidential Information of FINCAD Can your API be as easy as YouTube? ● Yes! For at least a few features. ● YouTube includes more complicated features: https://developers.google.com/youtube/ ● A lot of work to get something that simple ● Typical Twitter program (Python) to get a mass of tweets and save them to a file using the RESTful API: about 35 lines If you want mass-market adoption, simplicity is paramount.
  • 19. © 2014 - Proprietary and Confidential Information of FINCAD API Demonstration and Testing Tools • Swagger (Django REST Swagger) • Atlassian REST browser • Google Advanced REST client • cURL Show AND Tell with these tools. May need developer help—this is for everyone’s benefit!
  • 20. © 2014 - Proprietary and Confidential Information of FINCAD Pet Store Swagger
  • 21. © 2014 - Proprietary and Confidential Information of FINCAD Pet Store Swagger
  • 22. © 2014 - Proprietary and Confidential Information of FINCAD Model in Swagger
  • 23. © 2014 - Proprietary and Confidential Information of FINCAD Model
  • 24. © 2014 - Proprietary and Confidential Information of FINCAD What goes in the POST box? { "name":"Naive Cash Discounting USD", "format":"f3ml", "definition": "<f><n>ExtendModelWithBootstrappedInterpolationCurve</n><a><p><n>AutoSort</n><v><r> <b>F</b></r></v></p> <p><n>BaseModel</n><v><r><s>${- 1}</s></r></v></p><p><n>BootstrappingObjective</n><v><r><s>SingleCurrencyValue</s>< /r></v></p> <p><n>CurveTag</n><v><r><s>USD</s><s>DiscountCurve</s></r></v></p><p><n>Inter polationMethod</n><v><r><s>LogLinear</s></r></v></p> <p><n>MarketDataTag</n><v><r><s>CashDeposit:USD</s><s>CashDepo</s></r></v></p ><p><n>ModelName</n><v><r><s></s></r></v></p></a></f>" }
  • 25. © 2014 - Proprietary and Confidential Information of FINCAD Model by slug
  • 26. © 2014 - Proprietary and Confidential Information of FINCAD Flickr API Garden Look what you can do: https://www.flickr.com/services/api/explore/?method=flickr.photos.search
  • 27. © 2014 - Proprietary and Confidential Information of FINCAD PayPal test environment PayPal https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/
  • 28. © 2014 - Proprietary and Confidential Information of FINCAD API docs should include … • Description • Tutorials • Examples (Snippets, working apps) • Sandbox test environment • FAQs
  • 29. © 2014 - Proprietary and Confidential Information of FINCAD Your API docs should have … ● Clear versioning. (And when coding, use version number of the API.) ● Last-verified date, particularly for Web apps. ● FAQ ● Working code samples ● Suggestions for using API
  • 30. © 2014 - Proprietary and Confidential Information of FINCAD Twitter helps the API user Twitter site: There are a few great ways to follow the changes we make to the Twitter platform: • Follow @twitterapi. • Keep track of our Developer Blog and Discussions. • See the recently updated documentation. • Consult the Platform Calendar.
  • 31. © 2014 - Proprietary and Confidential Information of FINCAD Backlinks Twitter
  • 32. © 2014 - Proprietary and Confidential Information of FINCAD Twitter API doc page
  • 33. © 2014 - Proprietary and Confidential Information of FINCAD How do I get code samples? • Laziness! I encourage it! • Developers have created samples for tests (or they should!) • Quality Assurance has created samples for tests • Take these samples • Agree on a standard style • Build more based on these samples
  • 34. © 2014 - Proprietary and Confidential Information of FINCAD Do I need to code? • Empathy with our users is a core requirement for a tech writer • Learn to read and edit code • Increase your code-creation abilities • Coursera, Udacity, Khan Academy, etc. • Use support groups • All code samples are documentation; not all documentation is code.
  • 35. © 2014 - Proprietary and Confidential Information of FINCAD API Tutorial to try Sarah Maddox, previously of Atlassian and now of Google, wrote this tutorial: http://ffeathers.wordpress.com/2014/09/28/wa nt-a-rest-api-to-play-with/ Learn about code, docs, API design in one go!
  • 36. © 2014 - Proprietary and Confidential Information of FINCAD Resources http://jacobian.org/writing/what-to-write/ http://www.theparticlelab.com/good-api-documentation/ http://ffeathers.wordpress.com/ http://www.idratherbewriting.com/ http://www.programmableweb.com/ https://helloreverb.com/developers/swagger http://stackoverflow.com/questions/2001899/creating-great-api-documentation-tools-and-techniques http://stackoverflow.com/questions/1515326/what-do-you-consider-good-api-documentation https://www.youtube.com/watch?v=C5ws9ZNUfxc http://www.apiacademy.co http://apievangelist.com/2014/09/20/my-api-101-workshop-at-apistrat-in-chicago-next-week and more!
  • 37. © 2014 - Proprietary and Confidential Information of FINCAD
  • 38. © 2014 - Proprietary and Confidential Information of FINCAD L.Patterson@fincad.com @LoisRP