API workshop: Introduction to APIs (TC Camp)

Tom Johnson
Tom JohnsonSenior Technical Writer
API Documentation Workshop:
Introduction to APIs
By Tom Johnson
www.idratherbewriting.com
January 24, 2015
"Complete and accurate documentation" is most important factor in APIs, according to
a survey by @programmableweb. 250 respondents.
Important factors in API doc
Presentation by John Musser, founder of programmableweb.com,
which has directory of 12,000+ APIs
API workshop: Introduction to APIs (TC Camp)
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
Slides + recording + code samples are
freely downloadable
About me
• Started doing API/SDK documentation
a couple of 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
Disclaimer:
There’s a lot
of things I
simply do not
know.
Helpful to install for activities
• Eclipse for Java developers
• Chrome
• Chrome JSON Formatter extension
• Chrome Advanced REST client
• Sublime Text (Mac) or Notepad++ (Win)
• Git
No need to have prior knowledge of programming…
Download workshop files
1. Go to
https://github.com/tomjohnson1492/apiwor
kshop.
2. Click Download Zip. (Or bonus, clone the
repo.)
3. Unzip.
Tentative Outline
1. Introduction to API doc
2. Deep dive into REST API doc
3. Deep dive into code samples
3. Deep dive into Java and Javadoc
INTRODUCTION TO API DOC
Questions welcome at anytime
• What’s the biggest question you have about
API documentation?
Some basics about the API landscape
System B
System A
An API is an interface
between two systems.
Lots of different types
of APIs – for example:
1. Platform APIs that
you download and
add to your project
before compiling.
2. REST APIs that you
access through
HTTP web requests.
SDK versus API
• API (application programming interface): An
interface that provides endpoints, classes, or
other functions.
• SDK (software development kit): A set of
implementation tools to make it easier to work
with an API.
SDK example: A JavaScript SDK that allows you to
work with a particular REST API using JavaScript
syntax as your implementation format.
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, structuring it with
specific syntax that a
documentation generator can
read.
Comments get rendered into Javadoc
- Commonly used.
- Works only for Java.
- Run it from your IDE.
- Automate into builds.
- Explore other doclets.
- Has frame-based -
output.
- Can skin with CSS.
- Looks professional.
Doxygen
- Commonly used.
- Works with Java, C++,
C#, and others.
- Has easy front-end GUI.
- Point it at your source
files.
- Automate into builds.
- Can include non-source
files (Markdown).
- Frame-based output.
- Skinnable.
Good example of source-gen. doc
https://www.dropbox.com/developers/core
Each language
uses a doc
generator for
that language.
https://www.dropbox.com/developers/core
Pros of in-source documentation
- Avoids documentation
drift
- Allows the person who
creates the code (and
so best understands it)
to also document it
- Includes tooltips when
others incorporate the
library into their
projects
- Integrates into
developer’s IDE
Doc
SrcDoc Src
Continental drift
Pros/cons with Platform APIs
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.
API doc includes non-ref doc
Although reference doc tends to receive the
most attention, these docs are just one part of
API documentation. What technical writers
often work on is the implementation guide or
programmer’s guide on how to use the API. This
guide covers task-based information that shows
endpoints or classes used in particular
workflows and sequences to accomplish goals.
API workshop: Introduction to APIs (TC Camp)
REST API basics
URLs requests return specific data HTTP Request
Response
Responses in JSON or XML
Configuration
parameters
ResponseinJSONformat
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
Knowing what parameters
you can include with an
endpoint is a huge part of the
REST API documentation.
cURL calls
HTTP requests are often demonstrated through
cURL calls, with different HTTP methods:
GET – retrieve
POST – edit
PUT – create
DELETE – remove
You can use a command line to pass cURL calls, and
you can specify different HTTP methods.
Many sample REST calls
are demonstrated in cURL.
With REST APIs, auto-doc not as
common b/c source lang. varies
“The beauty of Web APIs is that they can be written in
whatever language you like and in whatever manner you
like. As long as when an HTTP request comes in, the proper
HTTP response goes out, it doesn't matter how it actually
happens on the server. But this very flexibility makes
automated documentation nearly impossible, since there's
no standard mapping between what an API request is and
what the code is that generates its response.”
-- Kin Lane, APIevangelist.com
Autodoc possibility: Swagger spec
RAML (REST API modeling language)
Swagger UI can parse the Swagger
syntax and render an output
Generates an endpoint
based on values you
enter
Mashery with Klout
Doc becomes
interactive
when you’re
signed in.
http://developer.klout.com/io-docs
Mashery.io
This is an API for
USA Today. The
Swagger and
RAML parsers
essentially create
an API explorer
experience with
some doc mixed
in.
http://developer.usatoday.com/io-docs
Swagger spec can be in source code or
in separate YML file
• Swagger spec syntax can be separate yml file
or integrated in code using a specific Swagger
library
• Swagger has various libraries for different
languages.
• Swagger spec is different from Swagger UI
• RAML is a competing spec to Swagger
Information survey on my blog
• 42 respondents working in API documentation
• Many people polled from API Documentation
group on Linkedin + blogosphere
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
How are you automating REST API
docs?
• - 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
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%
Takeaways from survey
• Java, Eclipse, Git are popular
• Become familiar with getting info from both
source code and developers
• Become a self-learner but also interact heavily
with engineers
• REST APIs are by far most common
• Automating REST API doc isn’t all that
common
Tom Johnson
http://idratherbewriting.com
@tomjohnson
Image credits
• slide 2: "API consumers want reliability, documentation and community."
Programmableweb.com. http://bit.ly/progwebsurvey
• slide 3: “10 Reasons Developers Hate Your API” (and what to do about it).
By John Musser. Slideshare. http://slidesha.re/1pnnDRf
• slide 4: Mars, once. By Kevin Dooley. http://bit.ly/ZFYI0T
• slide 15: Spinning gears. By Brent 2.0. Flickr. http://bit.ly/1DexWM0
• slide 21: Continental Drift. Wikipedia.
http://en.wikipedia.org/wiki/Continental_drift
• slide 24: Programmableweb Research Center.
http://www.programmableweb.com/api-research
1 de 51

Recomendados

Writing code samples for API/SDK documentation por
Writing code samples for API/SDK documentationWriting code samples for API/SDK documentation
Writing code samples for API/SDK documentationTom Johnson
6.3K visualizações30 slides
API Workshop: Deep dive into code samples por
API Workshop: Deep dive into code samplesAPI Workshop: Deep dive into code samples
API Workshop: Deep dive into code samplesTom Johnson
2.4K visualizações31 slides
API Workshop: Deep dive into REST APIs por
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsTom Johnson
4.6K visualizações80 slides
Survival Strategies for API Documentation: Presentation to Southwestern Ontar... por
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Tom Johnson
2.3K visualizações70 slides
API workshop: Deep dive into Java por
API workshop: Deep dive into JavaAPI workshop: Deep dive into Java
API workshop: Deep dive into JavaTom Johnson
2.9K visualizações63 slides
API Documentation Workshop tcworld India 2015 por
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015Tom Johnson
2.9K visualizações135 slides

Mais conteúdo relacionado

Mais procurados

Publishing API documentation -- Presentation por
Publishing API documentation -- PresentationPublishing API documentation -- Presentation
Publishing API documentation -- PresentationTom Johnson
2.3K visualizações30 slides
API Documentation -- Presentation to East Bay STC Chapter por
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterTom Johnson
474 visualizações79 slides
Publishing strategies for API documentation por
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentationTom Johnson
6.9K visualizações60 slides
STC Summit 2015: API Documentation, an Example-Based Approach por
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachLois Patterson
2.2K visualizações52 slides
Microservices with Swagger, Flask and Docker por
Microservices with Swagger, Flask and DockerMicroservices with Swagger, Flask and Docker
Microservices with Swagger, Flask and DockerDhilipsiva DS
963 visualizações15 slides
Play framework: lessons learned por
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learnedPeter Hilton
6.6K visualizações68 slides

Mais procurados(17)

Publishing API documentation -- Presentation por Tom Johnson
Publishing API documentation -- PresentationPublishing API documentation -- Presentation
Publishing API documentation -- Presentation
Tom Johnson2.3K visualizações
API Documentation -- Presentation to East Bay STC Chapter por Tom Johnson
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
Tom Johnson474 visualizações
Publishing strategies for API documentation por Tom Johnson
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentation
Tom Johnson6.9K visualizações
STC Summit 2015: API Documentation, an Example-Based Approach por Lois Patterson
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based Approach
Lois Patterson2.2K visualizações
Microservices with Swagger, Flask and Docker por Dhilipsiva DS
Microservices with Swagger, Flask and DockerMicroservices with Swagger, Flask and Docker
Microservices with Swagger, Flask and Docker
Dhilipsiva DS963 visualizações
Play framework: lessons learned por Peter Hilton
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
Peter Hilton6.6K visualizações
Process-oriented reactive service architecture por Peter Hilton
Process-oriented reactive service architectureProcess-oriented reactive service architecture
Process-oriented reactive service architecture
Peter Hilton1.1K visualizações
Hack in the Box GSEC 2016 - Reverse Engineering Swift Applications por eightbit
Hack in the Box GSEC 2016 - Reverse Engineering Swift ApplicationsHack in the Box GSEC 2016 - Reverse Engineering Swift Applications
Hack in the Box GSEC 2016 - Reverse Engineering Swift Applications
eightbit258 visualizações
HTTP demystified for web developers por Peter Hilton
HTTP demystified for web developersHTTP demystified for web developers
HTTP demystified for web developers
Peter Hilton1K visualizações
Bootstrapping iPhone Development por ThoughtWorks
Bootstrapping iPhone DevelopmentBootstrapping iPhone Development
Bootstrapping iPhone Development
ThoughtWorks832 visualizações
Tech breakfast 18 por James Leone
Tech breakfast 18Tech breakfast 18
Tech breakfast 18
James Leone275 visualizações
Developing an Ember Test Strategy - EmberConf 2019 por Todd Jordan
Developing an Ember Test Strategy - EmberConf 2019Developing an Ember Test Strategy - EmberConf 2019
Developing an Ember Test Strategy - EmberConf 2019
Todd Jordan270 visualizações
Java for Mainframers por Rich Helton
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton1.4K visualizações
iOS Development at Scale @Chegg por GalOrlanczyk
iOS Development at Scale @CheggiOS Development at Scale @Chegg
iOS Development at Scale @Chegg
GalOrlanczyk105 visualizações
Api design por xandesimoes
Api designApi design
Api design
xandesimoes783 visualizações
Rowdy Rabouw - Unleash your web skills on native por OdessaJS Conf
Rowdy Rabouw - Unleash your web skills on nativeRowdy Rabouw - Unleash your web skills on native
Rowdy Rabouw - Unleash your web skills on native
OdessaJS Conf333 visualizações
Handout 00 0 por Mahmoud
Handout 00 0Handout 00 0
Handout 00 0
Mahmoud 338 visualizações

Destaque

APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba... por
APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...
APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba...Toralf Richter
1.7K visualizações10 slides
Jee course web services por
Jee course web servicesJee course web services
Jee course web servicesodedns
1.5K visualizações71 slides
Building Scalable Backends with Go por
Building Scalable Backends with GoBuilding Scalable Backends with Go
Building Scalable Backends with GoShiju Varghese
1.1K visualizações20 slides
Managing File Transfers (MFT) por
Managing File Transfers (MFT)Managing File Transfers (MFT)
Managing File Transfers (MFT)Kellton Tech Solutions Ltd
2.6K visualizações31 slides
API strategy with IBM API connect por
API strategy with IBM API connectAPI strategy with IBM API connect
API strategy with IBM API connectKellton Tech Solutions Ltd
6.5K visualizações44 slides
Building High Performance APIs In Go Using gRPC And Protocol Buffers por
Building High Performance APIs In Go Using gRPC And Protocol BuffersBuilding High Performance APIs In Go Using gRPC And Protocol Buffers
Building High Performance APIs In Go Using gRPC And Protocol BuffersShiju Varghese
3.4K visualizações18 slides

Destaque(7)

APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba... por Toralf Richter
APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...APIs and Services for  Fleet Management - Talks given @ APIDays Berlin and Ba...
APIs and Services for Fleet Management - Talks given @ APIDays Berlin and Ba...
Toralf Richter1.7K visualizações
Jee course web services por odedns
Jee course web servicesJee course web services
Jee course web services
odedns1.5K visualizações
Building Scalable Backends with Go por Shiju Varghese
Building Scalable Backends with GoBuilding Scalable Backends with Go
Building Scalable Backends with Go
Shiju Varghese1.1K visualizações
Building High Performance APIs In Go Using gRPC And Protocol Buffers por Shiju Varghese
Building High Performance APIs In Go Using gRPC And Protocol BuffersBuilding High Performance APIs In Go Using gRPC And Protocol Buffers
Building High Performance APIs In Go Using gRPC And Protocol Buffers
Shiju Varghese3.4K visualizações
Accelerating Innovation with APIs: Social TV case study at Orange por Orange Dev
Accelerating Innovation with APIs: Social TV case study at OrangeAccelerating Innovation with APIs: Social TV case study at Orange
Accelerating Innovation with APIs: Social TV case study at Orange
Orange Dev2.9K visualizações

Similar a API workshop: Introduction to APIs (TC Camp)

API Documentation presentation to East Bay STC Chapter por
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterTom Johnson
2.3K visualizações79 slides
Practices and tools for building better API (JFall 2013) por
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Peter Hendriks
4.5K visualizações29 slides
Practices and tools for building better APIs por
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIsNLJUG
569 visualizações29 slides
Delivering Developer Tools at Scale por
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at ScaleOracle Developers
185 visualizações33 slides
OpenAPI and gRPC Side by-Side por
OpenAPI and gRPC Side by-SideOpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideTim Burks
2.9K visualizações40 slides
LF_APIStrat17_OpenAPI and gRPC Side-by-Side por
LF_APIStrat17_OpenAPI and gRPC Side-by-SideLF_APIStrat17_OpenAPI and gRPC Side-by-Side
LF_APIStrat17_OpenAPI and gRPC Side-by-SideLF_APIStrat
72 visualizações40 slides

Similar a API workshop: Introduction to APIs (TC Camp)(20)

API Documentation presentation to East Bay STC Chapter por Tom Johnson
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC Chapter
Tom Johnson2.3K visualizações
Practices and tools for building better API (JFall 2013) por Peter Hendriks
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
Peter Hendriks4.5K visualizações
Practices and tools for building better APIs por NLJUG
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
NLJUG569 visualizações
Delivering Developer Tools at Scale por Oracle Developers
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
Oracle Developers185 visualizações
OpenAPI and gRPC Side by-Side por Tim Burks
OpenAPI and gRPC Side by-SideOpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-Side
Tim Burks2.9K visualizações
LF_APIStrat17_OpenAPI and gRPC Side-by-Side por LF_APIStrat
LF_APIStrat17_OpenAPI and gRPC Side-by-SideLF_APIStrat17_OpenAPI and gRPC Side-by-Side
LF_APIStrat17_OpenAPI and gRPC Side-by-Side
LF_APIStrat72 visualizações
Content Strategy and Developer Engagement for DevPortals por Axway
Content Strategy and Developer Engagement for DevPortalsContent Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortals
Axway321 visualizações
Build Great Networked APIs with Swift, OpenAPI, and gRPC por Tim Burks
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Tim Burks1.4K visualizações
Practices and Tools for Building Better APIs por Peter Hendriks
Practices and Tools for Building Better APIsPractices and Tools for Building Better APIs
Practices and Tools for Building Better APIs
Peter Hendriks943 visualizações
Introduction to Apigility por Engineor
Introduction to ApigilityIntroduction to Apigility
Introduction to Apigility
Engineor1.7K visualizações
DevOps for Databricks por Databricks
DevOps for DatabricksDevOps for Databricks
DevOps for Databricks
Databricks1.1K visualizações
How to build a JavaScript toolkit por Michael Nelson
How to build a JavaScript toolkitHow to build a JavaScript toolkit
How to build a JavaScript toolkit
Michael Nelson290 visualizações
Apache Cordova 4.x por Ivano Malavolta
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
Ivano Malavolta1.2K visualizações
API Conference 2021 por José Haro Peralta
API Conference 2021API Conference 2021
API Conference 2021
José Haro Peralta190 visualizações
Api clarity webinar por LibbySchulze
Api clarity webinarApi clarity webinar
Api clarity webinar
LibbySchulze1K visualizações
Documenting an API for the First Time? Quick-Start Tips for Your First API Do... por Petko Mikhailov
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
Petko Mikhailov193 visualizações
Always up to date, testable and maintainable documentation with OpenAPI por GOG.com dev team
Always up to date, testable and maintainable documentation with OpenAPIAlways up to date, testable and maintainable documentation with OpenAPI
Always up to date, testable and maintainable documentation with OpenAPI
GOG.com dev team669 visualizações
Infinum Android Talks #02 - How to write an annotation processor in Android por Infinum
Infinum Android Talks #02 - How to write an annotation processor in AndroidInfinum Android Talks #02 - How to write an annotation processor in Android
Infinum Android Talks #02 - How to write an annotation processor in Android
Infinum4.2K visualizações
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no... por apidays
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays1.1K visualizações
2022 APIsecure_Securing APIs with Open Standards por APIsecure_ Official
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards
APIsecure_ Official50 visualizações

Último

Network Source of Truth and Infrastructure as Code revisited por
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisitedNetwork Automation Forum
52 visualizações45 slides
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... por
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...ShapeBlue
85 visualizações10 slides
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue por
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueShapeBlue
163 visualizações54 slides
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT por
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITShapeBlue
166 visualizações8 slides
Ransomware is Knocking your Door_Final.pdf por
Ransomware is Knocking your Door_Final.pdfRansomware is Knocking your Door_Final.pdf
Ransomware is Knocking your Door_Final.pdfSecurity Bootcamp
90 visualizações46 slides
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue por
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueShapeBlue
176 visualizações20 slides

Último(20)

Network Source of Truth and Infrastructure as Code revisited por Network Automation Forum
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisited
Network Automation Forum52 visualizações
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... por ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue85 visualizações
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue por ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue163 visualizações
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT por ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue166 visualizações
Ransomware is Knocking your Door_Final.pdf por Security Bootcamp
Ransomware is Knocking your Door_Final.pdfRansomware is Knocking your Door_Final.pdf
Ransomware is Knocking your Door_Final.pdf
Security Bootcamp90 visualizações
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue por ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue176 visualizações
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates por ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue210 visualizações
DRBD Deep Dive - Philipp Reisner - LINBIT por ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue140 visualizações
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... por ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue79 visualizações
Microsoft Power Platform.pptx por Uni Systems S.M.S.A.
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptx
Uni Systems S.M.S.A.80 visualizações
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... por ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue88 visualizações
The Role of Patterns in the Era of Large Language Models por Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li80 visualizações
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T por ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue112 visualizações
Data Integrity for Banking and Financial Services por Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely78 visualizações
Kyo - Functional Scala 2023.pdf por Flavio W. Brasil
Kyo - Functional Scala 2023.pdfKyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdf
Flavio W. Brasil449 visualizações
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool por ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue84 visualizações
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... por ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue120 visualizações
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... por James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson156 visualizações
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue por ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue222 visualizações
Future of AR - Facebook Presentation por Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty62 visualizações

API workshop: Introduction to APIs (TC Camp)

  • 1. API Documentation Workshop: Introduction to APIs By Tom Johnson www.idratherbewriting.com January 24, 2015
  • 2. "Complete and accurate documentation" is most important factor in APIs, according to a survey by @programmableweb. 250 respondents. Important factors in API doc
  • 3. Presentation by John Musser, founder of programmableweb.com, which has directory of 12,000+ APIs
  • 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
  • 8. Slides + recording + code samples are freely downloadable
  • 9. About me • Started doing API/SDK documentation a couple of 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 Disclaimer: There’s a lot of things I simply do not know.
  • 10. Helpful to install for activities • Eclipse for Java developers • Chrome • Chrome JSON Formatter extension • Chrome Advanced REST client • Sublime Text (Mac) or Notepad++ (Win) • Git No need to have prior knowledge of programming…
  • 11. Download workshop files 1. Go to https://github.com/tomjohnson1492/apiwor kshop. 2. Click Download Zip. (Or bonus, clone the repo.) 3. Unzip.
  • 12. Tentative Outline 1. Introduction to API doc 2. Deep dive into REST API doc 3. Deep dive into code samples 3. Deep dive into Java and Javadoc
  • 14. Questions welcome at anytime • What’s the biggest question you have about API documentation?
  • 15. Some basics about the API landscape System B System A An API is an interface between two systems. Lots of different types of APIs – for example: 1. Platform APIs that you download and add to your project before compiling. 2. REST APIs that you access through HTTP web requests.
  • 16. SDK versus API • API (application programming interface): An interface that provides endpoints, classes, or other functions. • SDK (software development kit): A set of implementation tools to make it easier to work with an API. SDK example: A JavaScript SDK that allows you to work with a particular REST API using JavaScript syntax as your implementation format.
  • 17. 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, structuring it with specific syntax that a documentation generator can read.
  • 18. Comments get rendered into Javadoc - Commonly used. - Works only for Java. - Run it from your IDE. - Automate into builds. - Explore other doclets. - Has frame-based - output. - Can skin with CSS. - Looks professional.
  • 19. Doxygen - Commonly used. - Works with Java, C++, C#, and others. - Has easy front-end GUI. - Point it at your source files. - Automate into builds. - Can include non-source files (Markdown). - Frame-based output. - Skinnable.
  • 20. Good example of source-gen. doc https://www.dropbox.com/developers/core Each language uses a doc generator for that language. https://www.dropbox.com/developers/core
  • 21. Pros of in-source documentation - Avoids documentation drift - Allows the person who creates the code (and so best understands it) to also document it - Includes tooltips when others incorporate the library into their projects - Integrates into developer’s IDE Doc SrcDoc Src Continental drift
  • 22. Pros/cons with Platform APIs 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.
  • 23. API doc includes non-ref doc Although reference doc tends to receive the most attention, these docs are just one part of API documentation. What technical writers often work on is the implementation guide or programmer’s guide on how to use the API. This guide covers task-based information that shows endpoints or classes used in particular workflows and sequences to accomplish goals.
  • 25. REST API basics URLs requests return specific data HTTP Request Response
  • 26. Responses in JSON or XML Configuration parameters ResponseinJSONformat
  • 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 Knowing what parameters you can include with an endpoint is a huge part of the REST API documentation.
  • 28. cURL calls HTTP requests are often demonstrated through cURL calls, with different HTTP methods: GET – retrieve POST – edit PUT – create DELETE – remove You can use a command line to pass cURL calls, and you can specify different HTTP methods. Many sample REST calls are demonstrated in cURL.
  • 29. With REST APIs, auto-doc not as common b/c source lang. varies “The beauty of Web APIs is that they can be written in whatever language you like and in whatever manner you like. As long as when an HTTP request comes in, the proper HTTP response goes out, it doesn't matter how it actually happens on the server. But this very flexibility makes automated documentation nearly impossible, since there's no standard mapping between what an API request is and what the code is that generates its response.” -- Kin Lane, APIevangelist.com
  • 31. RAML (REST API modeling language)
  • 32. Swagger UI can parse the Swagger syntax and render an output Generates an endpoint based on values you enter
  • 33. Mashery with Klout Doc becomes interactive when you’re signed in. http://developer.klout.com/io-docs
  • 34. Mashery.io This is an API for USA Today. The Swagger and RAML parsers essentially create an API explorer experience with some doc mixed in. http://developer.usatoday.com/io-docs
  • 35. Swagger spec can be in source code or in separate YML file • Swagger spec syntax can be separate yml file or integrated in code using a specific Swagger library • Swagger has various libraries for different languages. • Swagger spec is different from Swagger UI • RAML is a competing spec to Swagger
  • 36. Information survey on my blog • 42 respondents working in API documentation • Many people polled from API Documentation group on Linkedin + blogosphere
  • 37. Types of APIs that writers document 0% 10% 20% 30% 40% 50% 60% 70% 80% 90%
  • 38. Are you automating REST API docs? No Yes N/A 0% 10% 20% 30% 40% 50% 60% 70% Percent
  • 39. How are you automating REST API docs? • - 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
  • 40. Authoring tools used by API doc writers 0 10 20 30 40 50 60 70 80
  • 41. Do you test out the API calls used in your doc yourself? Yes No Sometimes 0% 10% 20% 30% 40% 50% 60%
  • 42. What IDE do you use? Eclipse None Visual Studio IntelliJ IDEA Xcode Other 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50%
  • 43. Most common programming languages tech writers know 0 5 10 15 20 25
  • 44. Do developers write the initial API documentation in the source code? Yes No Sometimes 28% 29% 30% 31% 32% 33% 34% 35% 36% 37%
  • 45. Do you write doc by looking in the source code? Yes No 0% 10% 20% 30% 40% 50% 60% 70%
  • 46. 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%
  • 47. 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
  • 48. How did you learn what you needed to know? 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50%
  • 49. Takeaways from survey • Java, Eclipse, Git are popular • Become familiar with getting info from both source code and developers • Become a self-learner but also interact heavily with engineers • REST APIs are by far most common • Automating REST API doc isn’t all that common
  • 51. Image credits • slide 2: "API consumers want reliability, documentation and community." Programmableweb.com. http://bit.ly/progwebsurvey • slide 3: “10 Reasons Developers Hate Your API” (and what to do about it). By John Musser. Slideshare. http://slidesha.re/1pnnDRf • slide 4: Mars, once. By Kevin Dooley. http://bit.ly/ZFYI0T • slide 15: Spinning gears. By Brent 2.0. Flickr. http://bit.ly/1DexWM0 • slide 21: Continental Drift. Wikipedia. http://en.wikipedia.org/wiki/Continental_drift • slide 24: Programmableweb Research Center. http://www.programmableweb.com/api-research

Notas do Editor

  1. http://www.programmableweb.com/news/api-consumers-want-reliability-documentation-and-community/2013/01/07
  2. ttp://www.slideshare.net/jmusser/ten-reasons-developershateyourapi Point out Bob Watson’s point – your API has to have the right functionality to begin with or it’s irrelevant to the programmer.
  3. Mars, once. By Kevin Dooley. http://bit.ly/ZFYI0T
  4. http://www.indeed.com/viewjob?jk=ebb2a2403d062299&from=tellafriend&utm_source=jobseeker_emails&utm_medium=email&cd%20-=tell_a_friend
  5. In this sense, you become the UI designer for your product!
  6. 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.
  7. 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.
  8. Spinning gears. By Brent 2.0. Flickr. http://bit.ly/1DexWM0
  9. Source code: http://www.docjar.net/html/api/java/util/Collections.java.html
  10. https://www.dropbox.com/developers/core
  11. From Programmableweb Research Center: http://www.programmableweb.com/api-research
  12. JSON is more popular because it’s lighter and faster.
  13. Demonstrate the variety of parameters you can add to the URL like this.
  14. Also enunciate http://enunciate.codehaus.org/ and https://github.com/mashery/iodocs
  15. http://developer.klout.com/io-docs
  16. http://developer.usatoday.com/io-docs
  17. For details, see http://idratherbewriting.com/2014/12/17/the-most-popular-type-of-apis-that-technical-writers-document/.
  18. For more details, see http://idratherbewriting.com/2014/12/24/authoring-tools-preferred-by-api-doc-writers-in-my-survey/.
  19. 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/.
  20. For more details, see http://idratherbewriting.com/2015/01/02/api-doc-survey-what-ide-do-you-use/.
  21. For more details, see http://idratherbewriting.com/2014/12/21/most-common-programming-languages-tech-writers-in-my-survey-know/.
  22. For more details, see http://idratherbewriting.com/2015/01/15/api-doc-survey-do-engineers-write-api-doc-in-the-source-code/.
  23. For more details, see http://idratherbewriting.com/2015/01/02/api-doc-survey-do-you-create-doc-by-looking-at-source-code/.
  24. For details, see http://idratherbewriting.com/2015/01/12/api-doc-survey-most-challenging-aspect-of-api-documentation/.
  25. For more details, see http://idratherbewriting.com/2015/01/06/api-doc-survey-result-how-to-learn-what-you-need-to-know/.