SlideShare a Scribd company logo
Survival Strategies for
API Documentation
By Tom Johnson
www.idratherbewriting.com
May 7, 2015
East Bay STC
"Complete and accurate documentation" is most important factor in APIs, according to
a survey by @programmableweb. 250 respondents. http://bit.ly/progwebsurvey
Important factors in API doc
Presentation by John Musser, founder of programmableweb.com,
which has directory of 12,000+ APIs. http://bit.ly/jmusserslideshare
Flickr http://bit.ly/ZFYI0T
Says, “The client wants to
find someone who'll emulate
Dropbox's developer
documentation”
Docs are how users
navigate an API product.
With APIs, docs are the interface
More
info
needed
Download for free at
http://bit.ly/stcintercoma
piissue
About me
• Started doing API/SDK
documentation 2+ years ago.
• Am still learning a ton, but enjoy
this type of documentation a lot.
• English major / writing background.
Not a programmer, but I do like
code.
• Blog and podcast at
idratherbewriting.com
Some basics about the API landscape
System B
System A
An API is an interface.
Lots of different types
of APIs – for example:
• Platform APIs
• REST APIs
Flickr:
http://bit.ly/1DexWM0
SDK versus API
• API (application programming interface):
Endpoints, classes, or other functions.
• SDK (software development kit):
Implementation tooling to support the API.
At least two deliverables
API Reference User Guides
Outline
1. Platform APIs
2. REST APIs
3. API documentation survey
4. API doc publishing trends
5. Questions to consider
DEEP DIVE INTO PLATFORM APIS
Auto-doc with Platform APIs
/**
* Reverses the order of the elements in the specified list.<p>
*
* This method runs in linear time.
*
*
* @param list the list whose elements are to be reversed.
* @throws UnsupportedOperationException if the specified list or
* its list-iterator does not support the <tt>set</tt>
operation.
*/
public static void reverse(List<?> list) {
int size = list.size()
if (size < REVERSE_THRESHOLD || list instanceof
RandomAccess) {
for (int i=0, mid=size>>1, j=size-1; i<mid;
i++, j--)
swap(list, i, j);
} else {
…
Add documentation in the
source code.
Comments get rendered into Javadoc
Doxygen
Good example of source-gen. doc
https://www.dropbox.com/developers/core
Each language
uses a different
doc generator.
https://www.dropbox.com/developers/core
Who writes the Javadoc?
• Usually engineers write initial draft.
• Tech writers edit.
• Tech writers might work in a doc branch.
Doc
branch
Main
branch
mergeCode
repo
Pros of in-source documentation
- Avoids doc drift
- Allows engineers to
document
- Includes tooltips in
IDE
Doc
SrcDoc Src
Continental drift
Wikipedia: http://bit.ly/contdriftwiki
Problem: Gives illusion of real doc
“… auto-generated
documentation is worse than
useless: it lets maintainers fool
themselves into thinking they
have documentation, thus
putting off actually writing good
reference by hand. If you don’t
have documentation just admit
to it. Maybe a volunteer will
offer to write some! But don’t
lie and give me that auto-
documentation crap”. – Jacob
Kaplan Moss
Looks real but
isn’t.
Flickr. http://bit.ly/1F1et36.
Problem: Doesn’t integrate
Like a HAT-produced
webhelp file, the
auto-doc is its own
website.
A developer who
creates the API
may assume too
much of the
audiences’
technical ability.
Problem: Curse of Knowledge
http://bit.ly/wsjpinker
Pros/cons with Platform APIs
Pros
- Performance
- Security
Cons
- Language coverage
- Upgrades
Flickr: http://bit.ly/serverroomflickr
DEEP DIVE INTO REST APIS
http://www.programmableweb.com/api-research
REST API basics
URLs requests return specific data HTTP Request
Response
Flickr.galleries.getPhotos
endpoint
Add parameters to endpoints
https://api.flickr.com/services/rest/?method=flic
kr.activity.userPhotos&api_key=1712c56e30dbad
5ef736245cda0d1cb9&per_page=10&format=js
on&nojsoncallback=1
Documenting parameters is
essential.
cURL calls
GET – retrieve
POST – edit
PUT – create
DELETE – remove
Use cURL to demo calls
REST API workflow
Sample endpoints
api_site.com/{apikey}/users
// gets all users
api_site.com/{apikey}/users/{userId}
// gets a specific user
api_site.com/{apikey}/rewards
// gets all rewards
api_site.com/{apikey}/rewards/{rewardId}
// gets a specific reward
api_site.com/{apikey}/users/{userId}/rewards
// gets all rewards for a specific user
api_site.com/{apikey}/users/{userId}/rewards/{rewardId}
// gets a specific reward for a specific user
A “RESTful web service”
has “endpoints” that
return “resources.”
Responses (JSON or XML)
{
"user”:"1234",
"userName":"Tom",
"userCreatedDate":"09021975",
”userStatus: "active"
}
A JSON object consists
of key: value pairs.
Some responses contain
arrays.
Get familiar with Developer Console
HTTP requests have methods
GET
POST
DELETE
PUT
Usually only submitted
using cURL.
Viewing methods for resources
Look on the Network
tab of your console.
EventBrite API example
Let’s get some event
details using the events
endpoint from the
EventBrite API.
https://developer.eventbrite.com/docs/event-details/
Get eventbrite event details
Endpoint:
eventbrite.api.com/v3/events/{event_id}
Endpoint with values:
https://www.eventbriteapi.com/v3/events/14635401881/
?token=C4QTJZP64YS5ITN4JSPM
Response:
{
"resource_uri":
"https://www.eventbriteapi.com/v3/events/14635401881/",
"name": {
"text": "API Workshop with Sarah Maddox",
},
"description": {
"text": "This is a practical course on API technical writing, consisting of…
Open your console and
inspect the payload
Accessing JSON using dot notation
To get the values from
the JSON, use dot
notation. If our object is
named data, then
data.name.text gets
that value.
 Activity: View payload values
1. In Chrome, open the JavaScript Console by
going to View > Developer > JavaScript
Console.
2. Now go to http://idratherbewriting.com/wp-
content/apidemos/eventbrite.html.
3. Expand the description and name sections in
the payload logged to the console.
Common sections in REST API doc
• Endpoint
• Description
• Parameters
• Methods
• Success response
• Error response
• Sample call
Cover these details for
each resource in your
REST API docs. Click
thumbnail for example.
Flickr Example: Get gallery photos
Get flickr photo gallery
Endpoint:
flickr.galleries.getPhotos
Endpoint with values:
https://api.flickr.com/services/rest/?method=fl
ickr.galleries.getPhotos&api_key=c962d7440cbbf3
81785c09989ba8032e&gallery_id=66911286-
72157647277042064&format=json&nojsoncallback=1
Response:
{
"score": 92.2655186160279,
"scoreDelta": {
"dayChange": 0.00044535591406713593,
… }
 Activity: Explore payload values
1. With the JavaScript Console open, go to
http://idratherbewriting.com/wp-
content/apidemos/flickr.html.
2. Inspect the payload logged to the console.
3. Try to find the image source URLs.
4. View the source code of the page to see how
the image URLs are constructed.
$("#flickr").append('<img src="https://farm' +
farmId + '.staticflickr.com/' + serverId + '/'
+ id + '_' + secret + '.jpg"/>');
API reference docs don’t
tell you how to actually do
a real task. To construct
the img URL, you need to
combine 4 different parts
from the response.
Flickr Result
More details on the API calls
Go here for details:
http://bit.ly/restapiexamples
Recommended Resource
http://bit.ly/docrestapis
API DOCUMENTATION SURVEY
Types of APIs that writers document
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
Are you automating REST API docs?
No Yes N/A
0%
10%
20%
30%
40%
50%
60%
70%
Percent
Authoring tools used by API doc
writers
0
10
20
30
40
50
60
70
80
Do you test out the API calls used in
your doc yourself?
Yes No Sometimes
0%
10%
20%
30%
40%
50%
60%
What IDE do you use?
Eclipse None Visual Studio IntelliJ IDEA Xcode Other
0%
5%
10%
15%
20%
25%
30%
35%
40%
45%
50%
Most common programming
languages tech writers know
0
5
10
15
20
25
Do developers write the initial API
documentation in the source code?
Yes No Sometimes
28%
29%
30%
31%
32%
33%
34%
35%
36%
37%
Do you write doc by looking in the
source code?
Yes No
0%
10%
20%
30%
40%
50%
60%
70%
How do you access the source code?
Git Perforce No access to
code
SVN Other Mercurial
0%
5%
10%
15%
20%
25%
30%
35%
40%
Most difficult part of API doc?
Understand
code
Get info from
engineers
Create non-ref
docs
Understand
audience
Identify
dependencies
0%
5%
10%
15%
20%
25%
30%
35%
40%
45%
50%
Percent
How did you learn what you needed to
know?
0%
5%
10%
15%
20%
25%
30%
35%
40%
45%
50%
PUBLISHING TRENDS WITH APIS
Programmableweb.com: API Directory
12,000 + web APIs
What design
trends or patterns
do we see among
popular API doc
sites?
Flickr: http://bit.ly/1sWdnln
Yelp API
One seamless website
matching product
branding.
http://www.yelp.com/developers/documentation
Twilio API
One output, with
nav tabs to show
different
languages
Twitter API
Interactive, real-
time requests
based on your
auth key
Dynamically
inserted API keys
into code samples.
https://stripe.com/docs/api
Foursquare API
Getting Started section,
providing a sample
“Hello World” tutorial
https://developer.foursquare.com/start
Youtube API
Lots of code samples,
usually with syntax
highlighting and
surrounding commentary.
https://developers.google.com/youtube/v3/code_samples/apps-script
Single page scroll w/ TOC highlight
Third column to show
responses or code samples.
http://crimson-cormorant.cloudvent.net/
Jekyll API doc theme from
CloudCannon
Automating API docs
• Swagger: 600+ repos
• RAML: 180+ repos
• API Blueprint: 120+ repos
– slide notes from Jennifer Rondeau presentation on
REST API Doc
Use Swagger Editor to create YML file
for Swagger
http://editor.swagger.io/#/edit
Swagger is just a
standard way of
describing your API
using a particular
schema.
Swagger UI’s output
http://petstore.swagger.wordnik.com/
QUESTIONS TO CONSIDER
Big questions to answer
Am I technical enough to
excel in API documentation?
Big questions to answer
Is API documentation dry
and boring?
Big questions to answer
How do I get into API
documentation in the first
place?
Tom Johnson
http://idratherbewriting.com
@tomjohnson

More Related Content

PPTX
API Workshop: Deep dive into code samples
PPTX
API Documentation Workshop tcworld India 2015
PPTX
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
PPTX
API workshop: Deep dive into Java
PPTX
API Workshop: Deep dive into REST APIs
PPTX
Writing code samples for API/SDK documentation
PPTX
API workshop: Introduction to APIs (TC Camp)
PPTX
Documenting REST APIs
API Workshop: Deep dive into code samples
API Documentation Workshop tcworld India 2015
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
API workshop: Deep dive into Java
API Workshop: Deep dive into REST APIs
Writing code samples for API/SDK documentation
API workshop: Introduction to APIs (TC Camp)
Documenting REST APIs

What's hot (18)

PPTX
Publishing API documentation -- Workshop
PPTX
Publishing strategies for API documentation
PDF
Scaling business app development with Play and Scala
KEY
CICONF 2012 - Don't Make Me Read Your Mind
PDF
Microservices with Swagger, Flask and Docker
PDF
Process-oriented reactive service architecture
PPTX
Automated UI Testing Done Right (QMSDNUG)
PPT
.NET Recommended Resources
PDF
The Testing Planet - July 2010
PDF
Python in the browser
PDF
Play framework: lessons learned
PDF
HTTP demystified for web developers
PPTX
Learning C# iPad Programming
PPTX
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
PPTX
Write Better JavaScript
PDF
I pad uicatalog_lesson02
PDF
Building Desktop RIAs With PHP And JavaScript
DOCX
Basic Java script handouts for students
Publishing API documentation -- Workshop
Publishing strategies for API documentation
Scaling business app development with Play and Scala
CICONF 2012 - Don't Make Me Read Your Mind
Microservices with Swagger, Flask and Docker
Process-oriented reactive service architecture
Automated UI Testing Done Right (QMSDNUG)
.NET Recommended Resources
The Testing Planet - July 2010
Python in the browser
Play framework: lessons learned
HTTP demystified for web developers
Learning C# iPad Programming
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
Write Better JavaScript
I pad uicatalog_lesson02
Building Desktop RIAs With PHP And JavaScript
Basic Java script handouts for students
Ad

Viewers also liked (9)

PPTX
Muscular system
PPTX
Make Your Content More Findable When Users Browse and Search
PPTX
Cirugias plasticas
PPTX
Perfecting the audio narration in instructional video
PPTX
Why users can't find answers in help material -- STC Sacramento presentation
PPTX
Publishing API documentation -- Presentation
PPTX
API Documentation presentation to East Bay STC Chapter
PDF
Producing Professional Sounding Audio in Video Tutorials
PPTX
Why users can't find answers in help material
Muscular system
Make Your Content More Findable When Users Browse and Search
Cirugias plasticas
Perfecting the audio narration in instructional video
Why users can't find answers in help material -- STC Sacramento presentation
Publishing API documentation -- Presentation
API Documentation presentation to East Bay STC Chapter
Producing Professional Sounding Audio in Video Tutorials
Why users can't find answers in help material
Ad

Similar to API Documentation -- Presentation to East Bay STC Chapter (20)

PDF
Documenting RESTful APIs with Spring REST Docs
DOCX
PPTX
Documenting APIs (with many pictures of cats) - APIStrat
PPTX
Building a REST API for Longevity
PPTX
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
PDF
Boost Your Content Strategy for REST APIs
PDF
Generating docs from APIs
PDF
Past, Present and Future of APIs of Mobile and Web Apps
PDF
REST API Doc Best Practices
PDF
API Best Practices
PDF
Moving into API documentation writing
PDF
API Docs Made Right / RAML - Swagger rant
PPTX
Documenting APIs: Sample Code and More (with many pictures of cats)
PPTX
STC Summit 2015: API Documentation, an Example-Based Approach
PPTX
How APIs are Changing Software Development
PDF
The Ultimate API Publisher's Guide
PDF
API Technical Writing
PDF
Crowd Documentation - How Programmer Social Communities are Flipping Software...
PDF
Consumer centric api design v0.4.0
PPTX
POST/CON 2019 Workshop: Design, Develop, and Mock APIs with Postman
Documenting RESTful APIs with Spring REST Docs
Documenting APIs (with many pictures of cats) - APIStrat
Building a REST API for Longevity
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
Boost Your Content Strategy for REST APIs
Generating docs from APIs
Past, Present and Future of APIs of Mobile and Web Apps
REST API Doc Best Practices
API Best Practices
Moving into API documentation writing
API Docs Made Right / RAML - Swagger rant
Documenting APIs: Sample Code and More (with many pictures of cats)
STC Summit 2015: API Documentation, an Example-Based Approach
How APIs are Changing Software Development
The Ultimate API Publisher's Guide
API Technical Writing
Crowd Documentation - How Programmer Social Communities are Flipping Software...
Consumer centric api design v0.4.0
POST/CON 2019 Workshop: Design, Develop, and Mock APIs with Postman

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Advanced IT Governance
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
NewMind AI Weekly Chronicles - August'25 Week I
NewMind AI Monthly Chronicles - July 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
Per capita expenditure prediction using model stacking based on satellite ima...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Advanced IT Governance
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx

API Documentation -- Presentation to East Bay STC Chapter

  • 1. Survival Strategies for API Documentation By Tom Johnson www.idratherbewriting.com May 7, 2015 East Bay STC
  • 2. "Complete and accurate documentation" is most important factor in APIs, according to a survey by @programmableweb. 250 respondents. http://bit.ly/progwebsurvey Important factors in API doc
  • 3. Presentation by John Musser, founder of programmableweb.com, which has directory of 12,000+ APIs. http://bit.ly/jmusserslideshare
  • 5. Says, “The client wants to find someone who'll emulate Dropbox's developer documentation”
  • 6. Docs are how users navigate an API product. With APIs, docs are the interface
  • 7. More info needed Download for free at http://bit.ly/stcintercoma piissue
  • 8. About me • Started doing API/SDK documentation 2+ years ago. • Am still learning a ton, but enjoy this type of documentation a lot. • English major / writing background. Not a programmer, but I do like code. • Blog and podcast at idratherbewriting.com
  • 9. Some basics about the API landscape System B System A An API is an interface. Lots of different types of APIs – for example: • Platform APIs • REST APIs Flickr: http://bit.ly/1DexWM0
  • 10. SDK versus API • API (application programming interface): Endpoints, classes, or other functions. • SDK (software development kit): Implementation tooling to support the API.
  • 11. At least two deliverables API Reference User Guides
  • 12. Outline 1. Platform APIs 2. REST APIs 3. API documentation survey 4. API doc publishing trends 5. Questions to consider
  • 13. DEEP DIVE INTO PLATFORM APIS
  • 14. Auto-doc with Platform APIs /** * Reverses the order of the elements in the specified list.<p> * * This method runs in linear time. * * * @param list the list whose elements are to be reversed. * @throws UnsupportedOperationException if the specified list or * its list-iterator does not support the <tt>set</tt> operation. */ public static void reverse(List<?> list) { int size = list.size() if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) { for (int i=0, mid=size>>1, j=size-1; i<mid; i++, j--) swap(list, i, j); } else { … Add documentation in the source code.
  • 15. Comments get rendered into Javadoc
  • 17. Good example of source-gen. doc https://www.dropbox.com/developers/core Each language uses a different doc generator. https://www.dropbox.com/developers/core
  • 18. Who writes the Javadoc? • Usually engineers write initial draft. • Tech writers edit. • Tech writers might work in a doc branch. Doc branch Main branch mergeCode repo
  • 19. Pros of in-source documentation - Avoids doc drift - Allows engineers to document - Includes tooltips in IDE Doc SrcDoc Src Continental drift Wikipedia: http://bit.ly/contdriftwiki
  • 20. Problem: Gives illusion of real doc “… auto-generated documentation is worse than useless: it lets maintainers fool themselves into thinking they have documentation, thus putting off actually writing good reference by hand. If you don’t have documentation just admit to it. Maybe a volunteer will offer to write some! But don’t lie and give me that auto- documentation crap”. – Jacob Kaplan Moss Looks real but isn’t. Flickr. http://bit.ly/1F1et36.
  • 21. Problem: Doesn’t integrate Like a HAT-produced webhelp file, the auto-doc is its own website.
  • 22. A developer who creates the API may assume too much of the audiences’ technical ability. Problem: Curse of Knowledge http://bit.ly/wsjpinker
  • 23. Pros/cons with Platform APIs Pros - Performance - Security Cons - Language coverage - Upgrades Flickr: http://bit.ly/serverroomflickr
  • 24. DEEP DIVE INTO REST APIS
  • 26. REST API basics URLs requests return specific data HTTP Request Response Flickr.galleries.getPhotos endpoint
  • 27. Add parameters to endpoints https://api.flickr.com/services/rest/?method=flic kr.activity.userPhotos&api_key=1712c56e30dbad 5ef736245cda0d1cb9&per_page=10&format=js on&nojsoncallback=1 Documenting parameters is essential.
  • 28. cURL calls GET – retrieve POST – edit PUT – create DELETE – remove Use cURL to demo calls
  • 30. Sample endpoints api_site.com/{apikey}/users // gets all users api_site.com/{apikey}/users/{userId} // gets a specific user api_site.com/{apikey}/rewards // gets all rewards api_site.com/{apikey}/rewards/{rewardId} // gets a specific reward api_site.com/{apikey}/users/{userId}/rewards // gets all rewards for a specific user api_site.com/{apikey}/users/{userId}/rewards/{rewardId} // gets a specific reward for a specific user A “RESTful web service” has “endpoints” that return “resources.”
  • 31. Responses (JSON or XML) { "user”:"1234", "userName":"Tom", "userCreatedDate":"09021975", ”userStatus: "active" } A JSON object consists of key: value pairs.
  • 33. Get familiar with Developer Console
  • 34. HTTP requests have methods GET POST DELETE PUT Usually only submitted using cURL.
  • 35. Viewing methods for resources Look on the Network tab of your console.
  • 36. EventBrite API example Let’s get some event details using the events endpoint from the EventBrite API. https://developer.eventbrite.com/docs/event-details/
  • 37. Get eventbrite event details Endpoint: eventbrite.api.com/v3/events/{event_id} Endpoint with values: https://www.eventbriteapi.com/v3/events/14635401881/ ?token=C4QTJZP64YS5ITN4JSPM Response: { "resource_uri": "https://www.eventbriteapi.com/v3/events/14635401881/", "name": { "text": "API Workshop with Sarah Maddox", }, "description": { "text": "This is a practical course on API technical writing, consisting of…
  • 38. Open your console and inspect the payload
  • 39. Accessing JSON using dot notation To get the values from the JSON, use dot notation. If our object is named data, then data.name.text gets that value.
  • 40.  Activity: View payload values 1. In Chrome, open the JavaScript Console by going to View > Developer > JavaScript Console. 2. Now go to http://idratherbewriting.com/wp- content/apidemos/eventbrite.html. 3. Expand the description and name sections in the payload logged to the console.
  • 41. Common sections in REST API doc • Endpoint • Description • Parameters • Methods • Success response • Error response • Sample call Cover these details for each resource in your REST API docs. Click thumbnail for example.
  • 42. Flickr Example: Get gallery photos
  • 43. Get flickr photo gallery Endpoint: flickr.galleries.getPhotos Endpoint with values: https://api.flickr.com/services/rest/?method=fl ickr.galleries.getPhotos&api_key=c962d7440cbbf3 81785c09989ba8032e&gallery_id=66911286- 72157647277042064&format=json&nojsoncallback=1 Response: { "score": 92.2655186160279, "scoreDelta": { "dayChange": 0.00044535591406713593, … }
  • 44.  Activity: Explore payload values 1. With the JavaScript Console open, go to http://idratherbewriting.com/wp- content/apidemos/flickr.html. 2. Inspect the payload logged to the console. 3. Try to find the image source URLs. 4. View the source code of the page to see how the image URLs are constructed.
  • 45. $("#flickr").append('<img src="https://farm' + farmId + '.staticflickr.com/' + serverId + '/' + id + '_' + secret + '.jpg"/>'); API reference docs don’t tell you how to actually do a real task. To construct the img URL, you need to combine 4 different parts from the response.
  • 47. More details on the API calls Go here for details: http://bit.ly/restapiexamples
  • 50. Types of APIs that writers document 0% 10% 20% 30% 40% 50% 60% 70% 80% 90%
  • 51. Are you automating REST API docs? No Yes N/A 0% 10% 20% 30% 40% 50% 60% 70% Percent
  • 52. Authoring tools used by API doc writers 0 10 20 30 40 50 60 70 80
  • 53. Do you test out the API calls used in your doc yourself? Yes No Sometimes 0% 10% 20% 30% 40% 50% 60%
  • 54. What IDE do you use? Eclipse None Visual Studio IntelliJ IDEA Xcode Other 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50%
  • 55. Most common programming languages tech writers know 0 5 10 15 20 25
  • 56. Do developers write the initial API documentation in the source code? Yes No Sometimes 28% 29% 30% 31% 32% 33% 34% 35% 36% 37%
  • 57. Do you write doc by looking in the source code? Yes No 0% 10% 20% 30% 40% 50% 60% 70%
  • 58. How do you access the source code? Git Perforce No access to code SVN Other Mercurial 0% 5% 10% 15% 20% 25% 30% 35% 40%
  • 59. Most difficult part of API doc? Understand code Get info from engineers Create non-ref docs Understand audience Identify dependencies 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50% Percent
  • 60. How did you learn what you needed to know? 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50%
  • 63. What design trends or patterns do we see among popular API doc sites? Flickr: http://bit.ly/1sWdnln
  • 64. Yelp API One seamless website matching product branding. http://www.yelp.com/developers/documentation
  • 65. Twilio API One output, with nav tabs to show different languages
  • 66. Twitter API Interactive, real- time requests based on your auth key
  • 67. Dynamically inserted API keys into code samples. https://stripe.com/docs/api
  • 68. Foursquare API Getting Started section, providing a sample “Hello World” tutorial https://developer.foursquare.com/start
  • 69. Youtube API Lots of code samples, usually with syntax highlighting and surrounding commentary. https://developers.google.com/youtube/v3/code_samples/apps-script
  • 70. Single page scroll w/ TOC highlight Third column to show responses or code samples. http://crimson-cormorant.cloudvent.net/
  • 71. Jekyll API doc theme from CloudCannon
  • 72. Automating API docs • Swagger: 600+ repos • RAML: 180+ repos • API Blueprint: 120+ repos – slide notes from Jennifer Rondeau presentation on REST API Doc
  • 73. Use Swagger Editor to create YML file for Swagger http://editor.swagger.io/#/edit Swagger is just a standard way of describing your API using a particular schema.
  • 76. Big questions to answer Am I technical enough to excel in API documentation?
  • 77. Big questions to answer Is API documentation dry and boring?
  • 78. Big questions to answer How do I get into API documentation in the first place?

Editor's Notes

  • #3: http://bit.ly/progwebsurvey
  • #4: http://www.slideshare.net/jmusser/ten-reasons-developershateyourapi http://bit.ly/jmusserslideshare Point out Bob Watson’s point – your API has to have the right functionality to begin with or it’s irrelevant to the programmer.
  • #5: Mars, once. By Kevin Dooley. http://bit.ly/ZFYI0T
  • #6: http://www.indeed.com/viewjob?jk=ebb2a2403d062299&from=tellafriend&utm_source=jobseeker_emails&utm_medium=email&cd%20-=tell_a_friend
  • #7: In this sense, you become the UI designer for your product!
  • #8: This is an area we need a lot more information about in tech comm, but it’s also an area that tech comm can apply its expertise to.
  • #9: Not a veteran tech writer for developer doc, but it's interesting to me. It's almost another field that is parallel to tech comm. Hard for tech writers to really excel in this field without some dev background, so there's not a lot of info on this topic. Recently asked to do an issue on tech comm trends; I said an issue on API doc would be better, b/c API doc is itself a trend.
  • #10: Spinning gears. By Brent 2.0. Flickr. http://bit.ly/1DexWM0
  • #15: Source code: http://www.docjar.net/html/api/java/util/Collections.java.html
  • #18: https://www.dropbox.com/developers/core
  • #19: Often engineers write reference documentation, but the Javadoc is often incomplete, unclear, inconsistent, or otherwise problematic. Some power API writers/developers might look at the source code and create documentation from scratch, but this is less common.
  • #20: Continental Drift. Wikipedia. http://en.wikipedia.org/wiki/Continental_drift http://bit.ly/contdriftwiki
  • #21: The false. By Cristopher Cotrell. Flickr. http://bit.ly/1F1et36. Quote from Jacob Kaplan Moss here: http://jacobian.org/writing/what-to-write/ Another source: “Auto-generated documentation that documents each API end-point directly from source code have their place (e.g., its great for team that built the API and its great for a reference document) but hand-crafted quality documentation that walks you through a use case for the API is invaluable. It should tell you about the key end-points that are needed for solving a particular problem and it should provide you with code samples.” https://communities.cisco.com/community/developer/blog/2014/09/03/introducing-devnet-slate
  • #23: The Source of Bad Writing. Wall Street Journal. http://online.wsj.com/articles/the-cause-of-bad-writing-1411660188 http://bit.ly/wsjpinker
  • #24: Flickr: http://bit.ly/serverroomflickr. Tom Raftery, Server room with grass Pros Performance: Performance is faster. (REST APIs struggle with latency for web calls.) Security: More secure. Cons Language coverage: Harder for devs to create APIs for each language (C++, Java, etc.). As prog. languages proliferate, it’s harder to keep up. Upgrades: Once clients install, it’s hard to encourage upgrades to latest versions.
  • #26: From Programmableweb Research Center: http://www.programmableweb.com/api-research
  • #28: Demonstrate the variety of parameters you can add to the URL like this.
  • #30: Client-server architecture: You send a request and get a response back. REST is the model of the web. REST APIs also called “web APIs.” REST = “representational state transfer” – data transfer modeled after the web. Protocol transfer is HTTP. Requests are made through URLs. Can see the response in the browser. Responses are stateless -- not remembered.
  • #37: https://developer.eventbrite.com/docs/event-details/
  • #38: https://www.eventbriteapi.com/v3/events/14635401881/?token=C4QTGZP64YS5ITN4JSPM
  • #42: Take a look at an example: https://developer.eventbrite.com/docs/event-details/
  • #51: For details, see http://idratherbewriting.com/2014/12/17/the-most-popular-type-of-apis-that-technical-writers-document/.
  • #52: - custom scripts - custom tooling - homegrown framework - homegrown Python scripts - custom tooling - Swagger - Swagger - Swagger - Corilla.co - code responses auto-generated - some code samples auto-generated
  • #53: For more details, see http://idratherbewriting.com/2014/12/24/authoring-tools-preferred-by-api-doc-writers-in-my-survey/.
  • #54: For more details, see http://idratherbewriting.com/2015/01/02/api-doc-survey-do-you-test-out-the-api-calls-used-in-your-doc-yourself/.
  • #55: For more details, see http://idratherbewriting.com/2015/01/02/api-doc-survey-what-ide-do-you-use/.
  • #56: For more details, see http://idratherbewriting.com/2014/12/21/most-common-programming-languages-tech-writers-in-my-survey-know/.
  • #57: For more details, see http://idratherbewriting.com/2015/01/15/api-doc-survey-do-engineers-write-api-doc-in-the-source-code/.
  • #58: For more details, see http://idratherbewriting.com/2015/01/02/api-doc-survey-do-you-create-doc-by-looking-at-source-code/.
  • #60: For details, see http://idratherbewriting.com/2015/01/12/api-doc-survey-most-challenging-aspect-of-api-documentation/.
  • #61: For more details, see http://idratherbewriting.com/2015/01/06/api-doc-survey-result-how-to-learn-what-you-need-to-know/.
  • #64: Finger face with question. By Tsahi Levent-Levi. http://bit.ly/1sWdnln
  • #66: http://www.twilio.com/docs/api/rest/conference
  • #67: https://dev.twitter.com/rest/reference/get/statuses/user_timeline
  • #69: https://developer.foursquare.com/start
  • #70: https://developers.google.com/youtube/v3/code_samples/apps-script
  • #73: From slide 15 here: https://docs.google.com/presentation/d/1jejYiTagK7CnJ-ajiRO1-kbD6kzeA0R04o3W5_yKTvk/edit?pli=1#slide=id.g436148b7d_00
  • #74: http://editor.swagger.io/#/edit