understanding rest apis in 5 simple steps
TRANSCRIPT
![Page 1: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/1.jpg)
ParisJS Meetup December 3rd, 2016
Follow me on Twitter and/or tweet at me. @tessamero
By Tessa Mero
Understanding REST APIs in 5 Simple Steps
![Page 2: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/2.jpg)
2© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
REST != $this
![Page 3: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/3.jpg)
3© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
“It’s a way for two pieces of software to talk to each other”
Application Programming Interface
![Page 4: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/4.jpg)
4© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
STEP 1: Understanding the Purpose of APIs
![Page 5: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/5.jpg)
5© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Why are APIs so Important?
![Page 6: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/6.jpg)
6© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
API Growth from 2000 to 2016
2000 2005 2007 2009 2011 2013 2015 20160
5000
10000
15000
20000
25000
30000
35000API's
API's
Source: 2016 data from nordicapis.com. 2005-2015 data from rubenverborgh.github.io and 2000-2004 data from blog.cutter.com
![Page 7: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/7.jpg)
7© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
An API is like …
An API (Application Programming Interface) is best thought of as a contract provided by one piece of computer software to another.
![Page 8: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/8.jpg)
8© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
APIs help developers create apps that benefit the end user.
Yelp asks for Map Data
Google Maps returns map data
via API
Users sees list of
restaurants close to
them
![Page 9: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/9.jpg)
9© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
STEP 2: Learn what REST is
![Page 10: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/10.jpg)
10© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
A REST API defines a set of functions which developers can perform requests and receive responses via HTTP protocol such as GET and POST.
![Page 11: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/11.jpg)
11© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
REST is best explained as a way to talk to other machines through the server with an HTTP Protocol
Using Verbs (actions) and Nouns (items)
![Page 12: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/12.jpg)
12© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
STEP 3: Know What Request and Responses are
![Page 13: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/13.jpg)
13© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
13
View a Web Page
Presentation ID
![Page 14: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/14.jpg)
14© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
14
View a Web Page
Presentation ID
Request GET /index.htm HTTP/1.1
ResponseHTTP 200 OK
<html>
![Page 15: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/15.jpg)
15© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
REST APIs use Request and Response too
![Page 16: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/16.jpg)
16© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
16
Get Data using an API (Spark)
Presentation ID
![Page 17: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/17.jpg)
17© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
17
Get Data using an API – Response!
Presentation ID
Request GET /rooms
ResponseHTTP 200 OK
{json data}
API Consumer API Provider
![Page 18: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/18.jpg)
18© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
List of Verbs!
![Page 19: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/19.jpg)
19© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
STEP 4: Documentation is Your Dictionary
![Page 20: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/20.jpg)
20© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
API Reference for Rooms (Verbs and Nouns)
![Page 21: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/21.jpg)
21© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Request Parameters for “MESSAGES”
![Page 22: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/22.jpg)
22© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
STEP 5: Learn How to Use Debug/Test Tools for APIs
![Page 23: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/23.jpg)
23© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Tools to Debug/Test http://tiny.cc/60tools
• Webhook Debugging (RequestBin formerly requestbin.org…)• Webhook Utilities (Torpio…)• Local Tunneling (ngrok...)• API Monitoring (Runscope...)• Response Mocking (mocky.io...) • JSON Utilities (JSONFormat...)• OAUTH Utilities (oauth.io...)• API Directories (APIS.io, ProgrammableWeb...)• API Testing (Runscope Radar...)• Load Testing (loader.io...)• GUI HTTP Clients (POSTMAN...)
![Page 24: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/24.jpg)
24© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
POSTMAN!!!!!
![Page 25: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/25.jpg)
25© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
25
method
url
requestheaders
status code
response headers
content-type
responsebody
query parameters
![Page 26: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/26.jpg)
26© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Summary:
1. You Understand the Purpose2. You Know what REST is3. Request & Response – Makes sense4. Documentation – Live by it.5. Debugging&Test Tools – Prevent headaches
![Page 27: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/27.jpg)
27© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
OUI!!!!!!!!
![Page 28: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/28.jpg)
28© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Confidential
Thank You
![Page 29: Understanding REST APIs in 5 Simple Steps](https://reader036.vdocuments.site/reader036/viewer/2022062412/588370321a28ab536b8b6fa5/html5/thumbnails/29.jpg)