SlideShare a Scribd company logo
DOCUMENTING REST APIS
BY TOM JOHNSON
IDRATHERBEWRITING.COM
STC Summit 2015  Columbus, Ohio  @tomjohnson
CONVENTIONS
• Access the course module at
http://idratherberwriting.com/restapicourse
• 1.1 Numbers in slide headings refers to the place in the
course module.
•  This icon indicates an activity you’re supposed to do.
• If you get lost, read the course page.
1.0 OVERVIEW
• Focus of the course is REST APIs
• Time to completion
• Learn with a real example and context
• No programming skills required
1.0 OVERVIEW
What you’ll need:
• Text editor
• Chrome browser
• Postman REST Client
• cURL
• Network connection
Follow along online:
idratherbewriting.com/restapicourse
1.1 INTRODUCTION TO REST
API DOCUMENTATION
Complete and
accurate docs are
most important factor
in APIs
1.1 INTRODUCTION TO REST
API DOCUMENTATION
REST APIs are
taking off in a
huge way
1.1 INTRODUCTION TO REST
API DOCUMENTATION
Job market is hot for
API technical writers
1.1 INTRODUCTION TO REST
API DOCUMENTATION
API doc is a new
world for most tech
writers
1.1 INTRODUCTION TO REST
API DOCUMENTATION
Increasing learning
materials about API
documentation
1.2 USING A REST API LIKE A
DEVELOPER
An API is an interface
between systems.
1.2 USING A REST API LIKE A
DEVELOPER
Our course scenario:
Weather forecast API
1.2 USING A REST API LIKE A
DEVELOPER
 Get an idea of the
end goal
1.2 USING A REST API LIKE A
DEVELOPER
 Browse the
available APIs on
Mashape
1.2 USING A REST API LIKE A
DEVELOPER
Find the
"Weather" API by
fyhao
1.2 USING A REST API LIKE A
DEVELOPER
 Answer some questions about the API
• What does the API do?
• How many endpoints does the API have?
• What does each endpoint do?
• What kind of parameters does each endpoint take?
• What kind of response does the endpoint provide?
✔ Terminology tip: API == Endpoint
1.3 GET THE
AUTHORIZATION KEYS
• Authorization for making API calls
• License access to the API
• Rate limit the number of requests
• Control availability of certain features within
the API
1.3 GET THE
AUTHORIZATION KEYS
 Get the
Mashape
authorization keys
1.3 GET THE
AUTHORIZATION KEYS
 To get the keys:
1. Click Sign Up Free and create an account.
2. Click Applications on the top nav bar.
3. Click Get the Key.
4. In the dialog box, click Copy. (Choose the Testing
keys.)
5. Open up a text editor and paste the key.
1.3 GET THE
AUTHORIZATION KEYS
Text editors:
• Sublime Text (Mac or PC)
• TextWrangler (Mac)
• WebStorm (Mac or PC)
• Notepad++ (PC)
1.4 MAKE A CURL CALL
 Prepare the cURL call:
1. Go into Weather API.
2. Copy the cURL request example for the aqi
endpoint into your text editor.
3. Important: If you're on Windows, change the single
quotes to double, and add -k as well to work around
security certificate issues.
4. Swap in your own API key.
5. Use Google Maps to find the latitude and longtitude
of your current location.
1.4 MAKE A CURL CALL
 Make the call in cURL (Mac)
1. Open a terminal.
2. Paste the call you have in your text editor into the
command line.
3. Press your Enter key.
1.4 MAKE A CURL CALL
 Make the call in cURL (Windows)
1. Copy the cURL call from your text editor.
2. Go to Start and type cmd to open up the command
line.
3. Right-click and then select Paste to insert the call.
1.4 MAKE A CURL CALL
If it didn’t work, try the Advanced REST Client
• cURL is a cross-platform way to show requests and
responses
• REST APIs follow the same request/return model of the
web
•  Try using cURL to GET a web page:
curl http://example.com
1.5 UNDERSTANDING CURL
Requests and responses include headers too
 Use –i or -I include the response header:
curl http://example.com -i
curl http://example.com -I
1.5 UNDERSTANDING CURL
Other methods you can use besides GET:
• POST: Create a resource
• GET: Read a resource
• PUT: Update a resource
• DELETE: Delete a resource
1.5 UNDERSTANDING CURL
1.5 UNDERSTANDING CURL
Specifying the method with a cURL call
--get
-X GET
-x PUT
curl –X GET http://example.com
1.5 UNDERSTANDING CURL
Passing headers into the request:
-H
curl --get --include 'https://simple-
weather.p.mashape.com/aqi?lat=37.354108&lng=
-121.955236’ 
-H 'X-Mashape-Key:
WOyzMuE8c9mshcofZaBke3kw7lMtp1HjVGAjsndqIPbU
9n2eET' 
-H 'Accept: text/plain'
1.5 UNDERSTANDING CURL
Passing data into the request:
-d
curl -i -H "Accept: application/json" -X
POST -d "{status:MIA}"
http://personsreport.com?status
1.5 UNDERSTANDING CURL
Make cURL more readable:
curl -i 
-H "Accept: application/json" 
-X POST 
-d "{status:MIA}" 
http://personsreport.com?status
1.5 UNDERSTANDING CURL
Query strings:
?lat=37.354108&lng=-121.955236
Listening multiple parameters:
&parameter1&parameter2&parameter3
1.6 SUBMIT REST CALLS
THROUGH POSTMAN
GUI clients make REST calls a little easier
Common GUI clients:
• Postman
• Advanced REST Client
• Paw
1.6 SUBMIT REST CALLS
THROUGH POSTMAN
 Insert the cURL
call into Postman
following the
sample screenshot
1.6 SUBMIT REST CALLS
THROUGH POSTMAN
 View the format of the weatherdata response in pretty
JSON
1.7 ANALYZE THE JSON
RESPONSE
Prettify the JSON response:
http://jsonformatter.curiousconcept.com/
JSON is how most REST APIs structure the response
1.7 ANALYZE THE JSON
RESPONSE
JSON objects are key-value pairs:
{
"key1":"value1",
"key2":"value2"
}
JSON objects start and end with curly braces { }.
1.7 ANALYZE THE JSON
RESPONSE
JSON arrays are lists of items:
["first", "second", "third"]
Arrays start and end with square brackets [ ].
1.7 ANALYZE THE JSON
RESPONSE
An array can contain a list of objects:
[
{
"name":"Tom",
"age":39
},
{
"name":"Shannon",
"age":37
}
]
1.7 ANALYZE THE JSON
RESPONSE
An object can contain arrays:
children: ["Avery","Callie","lucy","Molly"],
hobbies:
["swimming","biking","drawing","horseplaying
"]
1.7 ANALYZE THE JSON
RESPONSE
 Identify the objects and arrays in the weatherdata API
response.
• Where are the objects?
• Where are the arrays?
1.8 LOG THE JSON
RESPONSE TO THE CONSOLE
Making use of the JSON response
 Use the sample code from Mashape to parse and
display the REST response:
http://docs.mashape.com/javascript
1.8 LOG THE JSON
RESPONSE TO THE CONSOLE
 Customize the Mashape code with the weatherdata
endpoint:
1. Open text editor. Insert Mashape code.
2. Customize the url to the useweatherdata endpoint.
3. Enter your API key.
4. Uncomment out the  next to console.log(data).
5. Save and view the file in Chrome.
6. Open the Developer Console: View > Developer >
JavaScript Console. Refresh page.
1.8 LOG THE JSON
RESPONSE TO THE CONSOLE
 You can customize your Console log messages
 Inspect the payload
 Replace "undefined”:
document.getElementById("output").innerHTML
=
data.query.results.channel.item.description;
1.9 ACCESS THE VALUES
FROM JSON
Dot notation allows you to access specific values from the
JSON response
data.query.results.channel.item.description
1.9 ACCESS THE VALUES
FROM JSON
How dot notation works
"data": {
"name": "Tom"
}
To access Tom, I would use data.name.
1.9 ACCESS THE VALUES
FROM JSON
Use square brackets to access the values in an array:
"data" : {
"items": ["ball", "bat", "glove"]
}
To access glove, you would use data.items[2]
1.9 ACCESS THE VALUES
FROM JSON
 Download the dotnotationexercise.html file from the
workshop files.
 Change john.children[0].child1 to display the
following:
• green
• nike
• goldenrod
• Sarah
1.9 ACCESS THE VALUES
FROM JSON
 Get the wind speed from the weather API weatherdata
endpoint.
 Download the windcalls.html file from the workshop files.
Look at the different values accessed from the JSON
response.
2.0 YOU HAVE A NEW API TO
DOCUMENT
Shift perspectives: Now you're the technical writer
You have a new endpoint to document
 Review the wiki page:
http://idratherbewriting.com/restapicourse2-0/
2.0 YOU HAVE A NEW API TO
DOCUMENT
Essential sections in REST API documentation:
• Resource description
• Endpoint
• Methods
• Parameters
• Request submission example
• Request response example
• Status and error codes
• Code samples
2.0 YOU HAVE A NEW API TO
DOCUMENT
 Create the basic structure for the endpoint
documentation
 Use a text editor to create the sections.
Bonus: Use Markdown syntax.
2.1 DOCUMENTING THE
RESOURCE DESCRIPTION
The terminology to describe a "resource" varies:
• API calls
• Endpoints
• API methods
• Calls
• Resources
• Objects
• Services
• Requests
2.1 DOCUMENTING THE
RESOURCE DESCRIPTION
 Look at some examples:
• Mailchimp
• Twitter
• Instagram
2.1 DOCUMENTING THE
RESOURCE DESCRIPTION
Referring to resources by the endpoint name can get
problematic:
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
api_site.com/{apikey}/users/{userId}/rewards/{missionId}
// gets the rewards for a specfic mission related to a specific user
api_site.com/{apikey}/missions/{missionid}/rewards
// gets the rewards available for a specific mission
2.1 DOCUMENTING THE
RESOURCE DESCRIPTION
One resource can
have multiple
endpoints
2.1 DOCUMENTING THE
RESOURCE DESCRIPTION
When describing the resource, start with a verb.
 Review some examples:
• Delicious API
• Foursquare API
• Box API
2.1 DOCUMENTING THE
RESOURCE DESCRIPTION
 Review the surf report wiki page (2.0) containing the
information about the endpoint, and try to describe the
endpoint in the length of one or two sentences.
2.1 DOCUMENTING THE
RESOURCE DESCRIPTION
•  Critique the Mashape Weather API descriptions
• There’s a difference between reference docs versus user
guides
• Re-using the resource description
2.2 DOCUMENTING THE
ENDPOINT DEF. AND METHOD
Terminology for the endpoint definition varies:
• Requests
• Endpoints
• API methods
• Resource URIs
• Resource URLs
• URLs
• URL syntax
2.2 DOCUMENTING THE
ENDPOINT DEF. AND METHOD
The endpoint definition usually contains the end path only
/surfreport/{beachId}
Represent parameter values with curly braces
2.2 DOCUMENTING THE
ENDPOINT DEF. AND METHOD
You can list the
method beside the
endpoint
2.2 DOCUMENTING THE
ENDPOINT DEF. AND METHOD
•  Write the endpoint definition for surfreport
• Aim for 1-3 sentences
2.3 DOCUMENTING
PARAMETERS
Parameters are
ways to configure
the endpoint
2.3 DOCUMENTING
PARAMETERS
Data types indicate the format for the values:
• String
• Integer
• boolean
2.3 DOCUMENTING
PARAMETERS
• Parameter order doesn’t matter
/surfreport/{beachID}?days=3&units=metric&ti
me=1400
• Note any max and min values
• Note whether parameters are optional or required
2.3 DOCUMENTING
PARAMETERS
• You can also pass parameters in the JSON body
{
"days": 2,
"units": "imperial",
"time": 1433524597
}
• Time values usually follow ISO or Unix format
2.3 DOCUMENTING
PARAMETERS
 Construct a table to list the surfreport parameters
2.4 DOCUMENTING SAMPLE
REQUESTS
The sample request clarifies how to use the endpoint
http://api.nytimes.com/svc/search/v2/article
search.response-format?[q=search
term&fq=filter-field:(filter-
term)&additional-params=values]&api-key=####
2.4 DOCUMENTING SAMPLE
REQUESTS
API Explorers
provide interactivity
with your own data
2.4 DOCUMENTING SAMPLE
REQUESTS
API Explorers can be
dangerous in the hands of
a newbie
2.4 DOCUMENTING SAMPLE
REQUESTS
• If different requests return different responses, show
multiple responses
 Document the sample request with the
surfreport/{beachId} endpoint
2.5 DOCUMENTING SAMPLE
RESPONSES
• Provide a sample response for the endpoint
• Example from Flattr API
• Define what the values mean in the endpoint response
2.5 DOCUMENTING SAMPLE
RESPONSES
Strategies for documenting nested objects
 Check out the following approaches:
• Dropbox
• Bit.ly
• eBay
2.5 DOCUMENTING SAMPLE
RESPONSES
Information design choice: Where to include the
response
2.5 DOCUMENTING SAMPLE
RESPONSES
• Use realistic values in the response
• Format the JSON in a readable way
• Add syntax highlighting
• Some APIs embed dynamic responses
2.5 DOCUMENTING SAMPLE
RESPONSES
 Create a section for a sample request in your
surfreport/{beachId} endpoint
2.6 DOCUMENTING RESPONSE
AND ERROR CODES
• Response codes let you know the status of the request
• Common status codes follow standard protocols:
http://www.restapitutorial.com/httpstatuscodes.html
2.6 DOCUMENTING RESPONSE
AND ERROR CODES
• List the HTTP
response and error
codes
• Main page and also on
each endpoint where
relevant
2.6 DOCUMENTING RESPONSE
AND ERROR CODES
 Run your request and look at your header code
 List three status codes for surfreport/{beachId}
2.7 DOCUMENTING CODE
SAMPLES IN REST APIS
• Code samples bridge the gap between reference and
user guides
•  Look at the code sample on Mashape:
http://docs.mashape.com/javascript
• Code samples are like candy for developers
2.7 DOCUMENTING CODE
SAMPLES IN REST APIS
• You are not the audience
• Focus on the why, not the what
• Focus on the why, not the what
• Focus your explanation on your company's code only
2.7 DOCUMENTING CODE
SAMPLES IN REST APIS
• Keep code samples simple
• Add both code comments and before-and-after
explanations
• Make code samples copy-and-pastable
2.7 DOCUMENTING CODE
SAMPLES IN REST APIS
Provide a code sample in your target language
2.7 DOCUMENTING CODE
SAMPLES IN REST APIS
• From code samples to real tasks in user guides
•  Your turn to practice: Create a code sample and
documentation for the surfreport endpoint
2.8 PUTTING IT ALL
TOGETHER
• View my sample here:
http://idratherbewriting.com/restapicourse2-8/
• Share and comment on each other’s samples?
2.9 CREATING THE USER
GUIDE
User guides versus reference documentation
Essential sections in a user guide:
• Overview
• Getting started
• Authorization keys
• Core concepts
• Rate limits
• Code samples
• Hello world tutorial
• Quick reference
• Glossary
2.9 CREATING THE USER
GUIDE
Overview
section
2.9 CREATING THE USER
GUIDE
Getting started
section
2.9 CREATING THE USER
GUIDE
Authorization keys
2.9 CREATING THE USER
GUIDE
Rate limits
2.9 CREATING THE USER
GUIDE
Quick reference
guide
3.0 COMPLETION
Learning summary
• How to make calls to an API using cURL and Postman
• How to pass parameters to API calls
• How to inspect the objects in the JSON payload
• How to use dot notation to access the JSON values you
want
• How to display the integrate the information into your site
3.0 COMPLETION
Learning summary
• Documenting the resource description
• Documenting the endpoint definition and method
• Documenting parameters
• Documenting the request example
• Documenting the response example
• Providing a code example
• Listing status codes
THANKS!
Tom Johnson
idratherbewriting.com
tomjohnson1492@gmail.com
IMAGE CREDITS
Most images are screenshots linked to a webpage, but some
are from Flickr. Required attribution is as follows:
• Structure, https://flic.kr/p/oFD6MM Rafal Zych
• Earth patterns. https://flic.kr/p/ssQqiL Evriel Venefice
• Dave’s Bike Tools, https://flic.kr/p/QMVMw Bri Pettis
Ad

More Related Content

What's hot (20)

Test automation
Test automationTest automation
Test automation
Xavier Yin
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
Postman
 
Using Postman to Automate API On-Boarding
Using Postman to Automate API On-BoardingUsing Postman to Automate API On-Boarding
Using Postman to Automate API On-Boarding
Postman
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
Sun Technlogies
 
software testing methodologies
software testing methodologiessoftware testing methodologies
software testing methodologies
Jhonny Jhon
 
Angular 14.pptx
Angular 14.pptxAngular 14.pptx
Angular 14.pptx
MohaNedGhawar
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
Postman
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
Kerry Buckley
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
Aleks Zinevych
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
Swati Bansal
 
React JS
React JSReact JS
React JS
Software Infrastructure
 
Cypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdfCypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdf
bacancytechnology
 
Automation testing real time interview question.pdf
Automation testing real time interview question.pdfAutomation testing real time interview question.pdf
Automation testing real time interview question.pdf
Enjoyr
 
API Test Automation using Karate.pdf
API Test Automation using Karate.pdfAPI Test Automation using Karate.pdf
API Test Automation using Karate.pdf
Venessa Serrao
 
Test automation methodologies
Test automation methodologiesTest automation methodologies
Test automation methodologies
Mesut Günes
 
API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)
Peter Thomas
 
Fiverr html5 test answers 2020
Fiverr html5 test answers 2020Fiverr html5 test answers 2020
Fiverr html5 test answers 2020
Roobon Habib
 
Selenium interview questions
Selenium interview questionsSelenium interview questions
Selenium interview questions
girichinna27
 
Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”
Postman
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Test automation
Test automationTest automation
Test automation
Xavier Yin
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
Postman
 
Using Postman to Automate API On-Boarding
Using Postman to Automate API On-BoardingUsing Postman to Automate API On-Boarding
Using Postman to Automate API On-Boarding
Postman
 
software testing methodologies
software testing methodologiessoftware testing methodologies
software testing methodologies
Jhonny Jhon
 
Postman: An Introduction for Developers
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
Postman
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
Kerry Buckley
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
Aleks Zinevych
 
Cypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdfCypress Automation Testing Tutorial (Part 1).pdf
Cypress Automation Testing Tutorial (Part 1).pdf
bacancytechnology
 
Automation testing real time interview question.pdf
Automation testing real time interview question.pdfAutomation testing real time interview question.pdf
Automation testing real time interview question.pdf
Enjoyr
 
API Test Automation using Karate.pdf
API Test Automation using Karate.pdfAPI Test Automation using Karate.pdf
API Test Automation using Karate.pdf
Venessa Serrao
 
Test automation methodologies
Test automation methodologiesTest automation methodologies
Test automation methodologies
Mesut Günes
 
API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)
Peter Thomas
 
Fiverr html5 test answers 2020
Fiverr html5 test answers 2020Fiverr html5 test answers 2020
Fiverr html5 test answers 2020
Roobon Habib
 
Selenium interview questions
Selenium interview questionsSelenium interview questions
Selenium interview questions
girichinna27
 
Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”Postman Webinar: “Continuous Testing with Postman”
Postman Webinar: “Continuous Testing with Postman”
Postman
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 

Viewers also liked (7)

Publishing API documentation -- Presentation
Publishing API documentation -- PresentationPublishing API documentation -- Presentation
Publishing API documentation -- Presentation
Tom Johnson
 
Publishing API documentation -- Workshop
Publishing API documentation -- WorkshopPublishing API documentation -- Workshop
Publishing API documentation -- Workshop
Tom Johnson
 
API Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC Chapter
Tom Johnson
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
Building Scalable Backends with Go
Building Scalable Backends with GoBuilding Scalable Backends with Go
Building Scalable Backends with Go
Shiju Varghese
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
Tom Johnson
 
Building High Performance APIs In Go Using gRPC And Protocol Buffers
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 Varghese
 
Publishing API documentation -- Presentation
Publishing API documentation -- PresentationPublishing API documentation -- Presentation
Publishing API documentation -- Presentation
Tom Johnson
 
Publishing API documentation -- Workshop
Publishing API documentation -- WorkshopPublishing API documentation -- Workshop
Publishing API documentation -- Workshop
Tom Johnson
 
API Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC Chapter
Tom Johnson
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
Building Scalable Backends with Go
Building Scalable Backends with GoBuilding Scalable Backends with Go
Building Scalable Backends with Go
Shiju Varghese
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
Tom Johnson
 
Building High Performance APIs In Go Using gRPC And Protocol Buffers
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 Varghese
 
Ad

Similar to Documenting REST APIs (20)

flask.pptx
flask.pptxflask.pptx
flask.pptx
asif290119
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web API
Kevin Hazzard
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
Oro Inc.
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
Tatiana Al-Chueyr
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2
Sumy PHP User Grpoup
 
API Design- Best Practices
API Design-   Best PracticesAPI Design-   Best Practices
API Design- Best Practices
Prakash Bhandari
 
Design API using RAML - basics
Design API using RAML - basicsDesign API using RAML - basics
Design API using RAML - basics
kunal vishe
 
Developing Apps with Azure AD
Developing Apps with Azure ADDeveloping Apps with Azure AD
Developing Apps with Azure AD
SharePointRadi
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using Php
Sudheer Satyanarayana
 
REST API Basics
REST API BasicsREST API Basics
REST API Basics
Tharindu Weerasinghe
 
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...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
Mario Cardinal
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
Patrick Savalle
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
Sachin G Kulkarni
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
NLJUG
 
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)
Practices and tools for building better API (JFall 2013)
Peter Hendriks
 
Schema-First API Design
Schema-First API DesignSchema-First API Design
Schema-First API Design
Yos Riady
 
Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)
Patrick Savalle
 
Effective API Documentation Strategies (With an API Documentation Example
Effective API Documentation Strategies (With an API Documentation ExampleEffective API Documentation Strategies (With an API Documentation Example
Effective API Documentation Strategies (With an API Documentation Example
Perfect Documentation
 
Business Applications Integration In The Cloud
Business Applications Integration In The CloudBusiness Applications Integration In The Cloud
Business Applications Integration In The Cloud
Anna Brzezińska
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web API
Kevin Hazzard
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
Oro Inc.
 
Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2Service approach for development Rest API in Symfony2
Service approach for development Rest API in Symfony2
Sumy PHP User Grpoup
 
Design API using RAML - basics
Design API using RAML - basicsDesign API using RAML - basics
Design API using RAML - basics
kunal vishe
 
Developing Apps with Azure AD
Developing Apps with Azure ADDeveloping Apps with Azure AD
Developing Apps with Azure AD
SharePointRadi
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using Php
Sudheer Satyanarayana
 
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...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
Mario Cardinal
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
Patrick Savalle
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
Sachin G Kulkarni
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
NLJUG
 
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)
Practices and tools for building better API (JFall 2013)
Peter Hendriks
 
Schema-First API Design
Schema-First API DesignSchema-First API Design
Schema-First API Design
Yos Riady
 
Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)
Patrick Savalle
 
Effective API Documentation Strategies (With an API Documentation Example
Effective API Documentation Strategies (With an API Documentation ExampleEffective API Documentation Strategies (With an API Documentation Example
Effective API Documentation Strategies (With an API Documentation Example
Perfect Documentation
 
Business Applications Integration In The Cloud
Business Applications Integration In The CloudBusiness Applications Integration In The Cloud
Business Applications Integration In The Cloud
Anna Brzezińska
 
Ad

More from Tom Johnson (11)

API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
Tom Johnson
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
Tom Johnson
 
API workshop: Deep dive into Java
API workshop: Deep dive into JavaAPI workshop: Deep dive into Java
API workshop: Deep dive into Java
Tom Johnson
 
API Workshop: Deep dive into code samples
API Workshop: Deep dive into code samplesAPI Workshop: Deep dive into code samples
API Workshop: Deep dive into code samples
Tom Johnson
 
Perfecting the audio narration in instructional video
Perfecting the audio narration in instructional videoPerfecting the audio narration in instructional video
Perfecting the audio narration in instructional video
Tom Johnson
 
Publishing strategies for API documentation
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentation
Tom Johnson
 
Writing code samples for API/SDK documentation
Writing code samples for API/SDK documentationWriting code samples for API/SDK documentation
Writing code samples for API/SDK documentation
Tom Johnson
 
Why users can't find answers in help material -- STC Sacramento presentation
Why users can't find answers in help material -- STC Sacramento presentationWhy users can't find answers in help material -- STC Sacramento presentation
Why users can't find answers in help material -- STC Sacramento presentation
Tom Johnson
 
Why users can't find answers in help material
Why users can't find answers in help materialWhy users can't find answers in help material
Why users can't find answers in help material
Tom Johnson
 
Make Your Content More Findable When Users Browse and Search
Make Your Content More Findable When Users Browse and SearchMake Your Content More Findable When Users Browse and Search
Make Your Content More Findable When Users Browse and Search
Tom Johnson
 
Producing Professional Sounding Audio in Video Tutorials
Producing Professional Sounding Audio in Video TutorialsProducing Professional Sounding Audio in Video Tutorials
Producing Professional Sounding Audio in Video Tutorials
Tom Johnson
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
Tom Johnson
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
Tom Johnson
 
API workshop: Deep dive into Java
API workshop: Deep dive into JavaAPI workshop: Deep dive into Java
API workshop: Deep dive into Java
Tom Johnson
 
API Workshop: Deep dive into code samples
API Workshop: Deep dive into code samplesAPI Workshop: Deep dive into code samples
API Workshop: Deep dive into code samples
Tom Johnson
 
Perfecting the audio narration in instructional video
Perfecting the audio narration in instructional videoPerfecting the audio narration in instructional video
Perfecting the audio narration in instructional video
Tom Johnson
 
Publishing strategies for API documentation
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentation
Tom Johnson
 
Writing code samples for API/SDK documentation
Writing code samples for API/SDK documentationWriting code samples for API/SDK documentation
Writing code samples for API/SDK documentation
Tom Johnson
 
Why users can't find answers in help material -- STC Sacramento presentation
Why users can't find answers in help material -- STC Sacramento presentationWhy users can't find answers in help material -- STC Sacramento presentation
Why users can't find answers in help material -- STC Sacramento presentation
Tom Johnson
 
Why users can't find answers in help material
Why users can't find answers in help materialWhy users can't find answers in help material
Why users can't find answers in help material
Tom Johnson
 
Make Your Content More Findable When Users Browse and Search
Make Your Content More Findable When Users Browse and SearchMake Your Content More Findable When Users Browse and Search
Make Your Content More Findable When Users Browse and Search
Tom Johnson
 
Producing Professional Sounding Audio in Video Tutorials
Producing Professional Sounding Audio in Video TutorialsProducing Professional Sounding Audio in Video Tutorials
Producing Professional Sounding Audio in Video Tutorials
Tom Johnson
 

Recently uploaded (20)

UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 

Documenting REST APIs

  • 1. DOCUMENTING REST APIS BY TOM JOHNSON IDRATHERBEWRITING.COM STC Summit 2015  Columbus, Ohio  @tomjohnson
  • 2. CONVENTIONS • Access the course module at http://idratherberwriting.com/restapicourse • 1.1 Numbers in slide headings refers to the place in the course module. •  This icon indicates an activity you’re supposed to do. • If you get lost, read the course page.
  • 3. 1.0 OVERVIEW • Focus of the course is REST APIs • Time to completion • Learn with a real example and context • No programming skills required
  • 4. 1.0 OVERVIEW What you’ll need: • Text editor • Chrome browser • Postman REST Client • cURL • Network connection Follow along online: idratherbewriting.com/restapicourse
  • 5. 1.1 INTRODUCTION TO REST API DOCUMENTATION Complete and accurate docs are most important factor in APIs
  • 6. 1.1 INTRODUCTION TO REST API DOCUMENTATION REST APIs are taking off in a huge way
  • 7. 1.1 INTRODUCTION TO REST API DOCUMENTATION Job market is hot for API technical writers
  • 8. 1.1 INTRODUCTION TO REST API DOCUMENTATION API doc is a new world for most tech writers
  • 9. 1.1 INTRODUCTION TO REST API DOCUMENTATION Increasing learning materials about API documentation
  • 10. 1.2 USING A REST API LIKE A DEVELOPER An API is an interface between systems.
  • 11. 1.2 USING A REST API LIKE A DEVELOPER Our course scenario: Weather forecast API
  • 12. 1.2 USING A REST API LIKE A DEVELOPER  Get an idea of the end goal
  • 13. 1.2 USING A REST API LIKE A DEVELOPER  Browse the available APIs on Mashape
  • 14. 1.2 USING A REST API LIKE A DEVELOPER Find the "Weather" API by fyhao
  • 15. 1.2 USING A REST API LIKE A DEVELOPER  Answer some questions about the API • What does the API do? • How many endpoints does the API have? • What does each endpoint do? • What kind of parameters does each endpoint take? • What kind of response does the endpoint provide? ✔ Terminology tip: API == Endpoint
  • 16. 1.3 GET THE AUTHORIZATION KEYS • Authorization for making API calls • License access to the API • Rate limit the number of requests • Control availability of certain features within the API
  • 17. 1.3 GET THE AUTHORIZATION KEYS  Get the Mashape authorization keys
  • 18. 1.3 GET THE AUTHORIZATION KEYS  To get the keys: 1. Click Sign Up Free and create an account. 2. Click Applications on the top nav bar. 3. Click Get the Key. 4. In the dialog box, click Copy. (Choose the Testing keys.) 5. Open up a text editor and paste the key.
  • 19. 1.3 GET THE AUTHORIZATION KEYS Text editors: • Sublime Text (Mac or PC) • TextWrangler (Mac) • WebStorm (Mac or PC) • Notepad++ (PC)
  • 20. 1.4 MAKE A CURL CALL  Prepare the cURL call: 1. Go into Weather API. 2. Copy the cURL request example for the aqi endpoint into your text editor. 3. Important: If you're on Windows, change the single quotes to double, and add -k as well to work around security certificate issues. 4. Swap in your own API key. 5. Use Google Maps to find the latitude and longtitude of your current location.
  • 21. 1.4 MAKE A CURL CALL  Make the call in cURL (Mac) 1. Open a terminal. 2. Paste the call you have in your text editor into the command line. 3. Press your Enter key.
  • 22. 1.4 MAKE A CURL CALL  Make the call in cURL (Windows) 1. Copy the cURL call from your text editor. 2. Go to Start and type cmd to open up the command line. 3. Right-click and then select Paste to insert the call.
  • 23. 1.4 MAKE A CURL CALL If it didn’t work, try the Advanced REST Client
  • 24. • cURL is a cross-platform way to show requests and responses • REST APIs follow the same request/return model of the web •  Try using cURL to GET a web page: curl http://example.com 1.5 UNDERSTANDING CURL
  • 25. Requests and responses include headers too  Use –i or -I include the response header: curl http://example.com -i curl http://example.com -I 1.5 UNDERSTANDING CURL
  • 26. Other methods you can use besides GET: • POST: Create a resource • GET: Read a resource • PUT: Update a resource • DELETE: Delete a resource 1.5 UNDERSTANDING CURL
  • 27. 1.5 UNDERSTANDING CURL Specifying the method with a cURL call --get -X GET -x PUT curl –X GET http://example.com
  • 28. 1.5 UNDERSTANDING CURL Passing headers into the request: -H curl --get --include 'https://simple- weather.p.mashape.com/aqi?lat=37.354108&lng= -121.955236’ -H 'X-Mashape-Key: WOyzMuE8c9mshcofZaBke3kw7lMtp1HjVGAjsndqIPbU 9n2eET' -H 'Accept: text/plain'
  • 29. 1.5 UNDERSTANDING CURL Passing data into the request: -d curl -i -H "Accept: application/json" -X POST -d "{status:MIA}" http://personsreport.com?status
  • 30. 1.5 UNDERSTANDING CURL Make cURL more readable: curl -i -H "Accept: application/json" -X POST -d "{status:MIA}" http://personsreport.com?status
  • 31. 1.5 UNDERSTANDING CURL Query strings: ?lat=37.354108&lng=-121.955236 Listening multiple parameters: &parameter1&parameter2&parameter3
  • 32. 1.6 SUBMIT REST CALLS THROUGH POSTMAN GUI clients make REST calls a little easier Common GUI clients: • Postman • Advanced REST Client • Paw
  • 33. 1.6 SUBMIT REST CALLS THROUGH POSTMAN  Insert the cURL call into Postman following the sample screenshot
  • 34. 1.6 SUBMIT REST CALLS THROUGH POSTMAN  View the format of the weatherdata response in pretty JSON
  • 35. 1.7 ANALYZE THE JSON RESPONSE Prettify the JSON response: http://jsonformatter.curiousconcept.com/ JSON is how most REST APIs structure the response
  • 36. 1.7 ANALYZE THE JSON RESPONSE JSON objects are key-value pairs: { "key1":"value1", "key2":"value2" } JSON objects start and end with curly braces { }.
  • 37. 1.7 ANALYZE THE JSON RESPONSE JSON arrays are lists of items: ["first", "second", "third"] Arrays start and end with square brackets [ ].
  • 38. 1.7 ANALYZE THE JSON RESPONSE An array can contain a list of objects: [ { "name":"Tom", "age":39 }, { "name":"Shannon", "age":37 } ]
  • 39. 1.7 ANALYZE THE JSON RESPONSE An object can contain arrays: children: ["Avery","Callie","lucy","Molly"], hobbies: ["swimming","biking","drawing","horseplaying "]
  • 40. 1.7 ANALYZE THE JSON RESPONSE  Identify the objects and arrays in the weatherdata API response. • Where are the objects? • Where are the arrays?
  • 41. 1.8 LOG THE JSON RESPONSE TO THE CONSOLE Making use of the JSON response  Use the sample code from Mashape to parse and display the REST response: http://docs.mashape.com/javascript
  • 42. 1.8 LOG THE JSON RESPONSE TO THE CONSOLE  Customize the Mashape code with the weatherdata endpoint: 1. Open text editor. Insert Mashape code. 2. Customize the url to the useweatherdata endpoint. 3. Enter your API key. 4. Uncomment out the next to console.log(data). 5. Save and view the file in Chrome. 6. Open the Developer Console: View > Developer > JavaScript Console. Refresh page.
  • 43. 1.8 LOG THE JSON RESPONSE TO THE CONSOLE  You can customize your Console log messages  Inspect the payload  Replace "undefined”: document.getElementById("output").innerHTML = data.query.results.channel.item.description;
  • 44. 1.9 ACCESS THE VALUES FROM JSON Dot notation allows you to access specific values from the JSON response data.query.results.channel.item.description
  • 45. 1.9 ACCESS THE VALUES FROM JSON How dot notation works "data": { "name": "Tom" } To access Tom, I would use data.name.
  • 46. 1.9 ACCESS THE VALUES FROM JSON Use square brackets to access the values in an array: "data" : { "items": ["ball", "bat", "glove"] } To access glove, you would use data.items[2]
  • 47. 1.9 ACCESS THE VALUES FROM JSON  Download the dotnotationexercise.html file from the workshop files.  Change john.children[0].child1 to display the following: • green • nike • goldenrod • Sarah
  • 48. 1.9 ACCESS THE VALUES FROM JSON  Get the wind speed from the weather API weatherdata endpoint.  Download the windcalls.html file from the workshop files. Look at the different values accessed from the JSON response.
  • 49. 2.0 YOU HAVE A NEW API TO DOCUMENT Shift perspectives: Now you're the technical writer You have a new endpoint to document  Review the wiki page: http://idratherbewriting.com/restapicourse2-0/
  • 50. 2.0 YOU HAVE A NEW API TO DOCUMENT Essential sections in REST API documentation: • Resource description • Endpoint • Methods • Parameters • Request submission example • Request response example • Status and error codes • Code samples
  • 51. 2.0 YOU HAVE A NEW API TO DOCUMENT  Create the basic structure for the endpoint documentation  Use a text editor to create the sections. Bonus: Use Markdown syntax.
  • 52. 2.1 DOCUMENTING THE RESOURCE DESCRIPTION The terminology to describe a "resource" varies: • API calls • Endpoints • API methods • Calls • Resources • Objects • Services • Requests
  • 53. 2.1 DOCUMENTING THE RESOURCE DESCRIPTION  Look at some examples: • Mailchimp • Twitter • Instagram
  • 54. 2.1 DOCUMENTING THE RESOURCE DESCRIPTION Referring to resources by the endpoint name can get problematic: 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 api_site.com/{apikey}/users/{userId}/rewards/{missionId} // gets the rewards for a specfic mission related to a specific user api_site.com/{apikey}/missions/{missionid}/rewards // gets the rewards available for a specific mission
  • 55. 2.1 DOCUMENTING THE RESOURCE DESCRIPTION One resource can have multiple endpoints
  • 56. 2.1 DOCUMENTING THE RESOURCE DESCRIPTION When describing the resource, start with a verb.  Review some examples: • Delicious API • Foursquare API • Box API
  • 57. 2.1 DOCUMENTING THE RESOURCE DESCRIPTION  Review the surf report wiki page (2.0) containing the information about the endpoint, and try to describe the endpoint in the length of one or two sentences.
  • 58. 2.1 DOCUMENTING THE RESOURCE DESCRIPTION •  Critique the Mashape Weather API descriptions • There’s a difference between reference docs versus user guides • Re-using the resource description
  • 59. 2.2 DOCUMENTING THE ENDPOINT DEF. AND METHOD Terminology for the endpoint definition varies: • Requests • Endpoints • API methods • Resource URIs • Resource URLs • URLs • URL syntax
  • 60. 2.2 DOCUMENTING THE ENDPOINT DEF. AND METHOD The endpoint definition usually contains the end path only /surfreport/{beachId} Represent parameter values with curly braces
  • 61. 2.2 DOCUMENTING THE ENDPOINT DEF. AND METHOD You can list the method beside the endpoint
  • 62. 2.2 DOCUMENTING THE ENDPOINT DEF. AND METHOD •  Write the endpoint definition for surfreport • Aim for 1-3 sentences
  • 64. 2.3 DOCUMENTING PARAMETERS Data types indicate the format for the values: • String • Integer • boolean
  • 65. 2.3 DOCUMENTING PARAMETERS • Parameter order doesn’t matter /surfreport/{beachID}?days=3&units=metric&ti me=1400 • Note any max and min values • Note whether parameters are optional or required
  • 66. 2.3 DOCUMENTING PARAMETERS • You can also pass parameters in the JSON body { "days": 2, "units": "imperial", "time": 1433524597 } • Time values usually follow ISO or Unix format
  • 67. 2.3 DOCUMENTING PARAMETERS  Construct a table to list the surfreport parameters
  • 68. 2.4 DOCUMENTING SAMPLE REQUESTS The sample request clarifies how to use the endpoint http://api.nytimes.com/svc/search/v2/article search.response-format?[q=search term&fq=filter-field:(filter- term)&additional-params=values]&api-key=####
  • 69. 2.4 DOCUMENTING SAMPLE REQUESTS API Explorers provide interactivity with your own data
  • 70. 2.4 DOCUMENTING SAMPLE REQUESTS API Explorers can be dangerous in the hands of a newbie
  • 71. 2.4 DOCUMENTING SAMPLE REQUESTS • If different requests return different responses, show multiple responses  Document the sample request with the surfreport/{beachId} endpoint
  • 72. 2.5 DOCUMENTING SAMPLE RESPONSES • Provide a sample response for the endpoint • Example from Flattr API • Define what the values mean in the endpoint response
  • 73. 2.5 DOCUMENTING SAMPLE RESPONSES Strategies for documenting nested objects  Check out the following approaches: • Dropbox • Bit.ly • eBay
  • 74. 2.5 DOCUMENTING SAMPLE RESPONSES Information design choice: Where to include the response
  • 75. 2.5 DOCUMENTING SAMPLE RESPONSES • Use realistic values in the response • Format the JSON in a readable way • Add syntax highlighting • Some APIs embed dynamic responses
  • 76. 2.5 DOCUMENTING SAMPLE RESPONSES  Create a section for a sample request in your surfreport/{beachId} endpoint
  • 77. 2.6 DOCUMENTING RESPONSE AND ERROR CODES • Response codes let you know the status of the request • Common status codes follow standard protocols: http://www.restapitutorial.com/httpstatuscodes.html
  • 78. 2.6 DOCUMENTING RESPONSE AND ERROR CODES • List the HTTP response and error codes • Main page and also on each endpoint where relevant
  • 79. 2.6 DOCUMENTING RESPONSE AND ERROR CODES  Run your request and look at your header code  List three status codes for surfreport/{beachId}
  • 80. 2.7 DOCUMENTING CODE SAMPLES IN REST APIS • Code samples bridge the gap between reference and user guides •  Look at the code sample on Mashape: http://docs.mashape.com/javascript • Code samples are like candy for developers
  • 81. 2.7 DOCUMENTING CODE SAMPLES IN REST APIS • You are not the audience • Focus on the why, not the what • Focus on the why, not the what • Focus your explanation on your company's code only
  • 82. 2.7 DOCUMENTING CODE SAMPLES IN REST APIS • Keep code samples simple • Add both code comments and before-and-after explanations • Make code samples copy-and-pastable
  • 83. 2.7 DOCUMENTING CODE SAMPLES IN REST APIS Provide a code sample in your target language
  • 84. 2.7 DOCUMENTING CODE SAMPLES IN REST APIS • From code samples to real tasks in user guides •  Your turn to practice: Create a code sample and documentation for the surfreport endpoint
  • 85. 2.8 PUTTING IT ALL TOGETHER • View my sample here: http://idratherbewriting.com/restapicourse2-8/ • Share and comment on each other’s samples?
  • 86. 2.9 CREATING THE USER GUIDE User guides versus reference documentation Essential sections in a user guide: • Overview • Getting started • Authorization keys • Core concepts • Rate limits • Code samples • Hello world tutorial • Quick reference • Glossary
  • 87. 2.9 CREATING THE USER GUIDE Overview section
  • 88. 2.9 CREATING THE USER GUIDE Getting started section
  • 89. 2.9 CREATING THE USER GUIDE Authorization keys
  • 90. 2.9 CREATING THE USER GUIDE Rate limits
  • 91. 2.9 CREATING THE USER GUIDE Quick reference guide
  • 92. 3.0 COMPLETION Learning summary • How to make calls to an API using cURL and Postman • How to pass parameters to API calls • How to inspect the objects in the JSON payload • How to use dot notation to access the JSON values you want • How to display the integrate the information into your site
  • 93. 3.0 COMPLETION Learning summary • Documenting the resource description • Documenting the endpoint definition and method • Documenting parameters • Documenting the request example • Documenting the response example • Providing a code example • Listing status codes
  • 95. IMAGE CREDITS Most images are screenshots linked to a webpage, but some are from Flickr. Required attribution is as follows: • Structure, https://flic.kr/p/oFD6MM Rafal Zych • Earth patterns. https://flic.kr/p/ssQqiL Evriel Venefice • Dave’s Bike Tools, https://flic.kr/p/QMVMw Bri Pettis