An Introduction to APIs Kevin Lewis - Developer Advocate, Vonage
Kevin Lewis » @_phzn » @vonagedev
Slide 2
Hi! I’m Kevin & I work for Vonage Integrate voice, video & messaging with our cloud communications platform.
Kevin Lewis » @_phzn » @vonagedev
Slide 3
You Got This Conferences Community events focusing on core skills needed for a happy, healthy work life.
Kevin Lewis » @_phzn » @vonagedev
Slide 4
Kevin Lewis » @_phzn » @vonagedev
Slide 5
In This Session First
Then
Finally
We’ll take time to understand APIs
We’ll use a couple of APIs ourselves
We’ll briefly cover more concepts
Kevin Lewis » @_phzn » @vonagedev
Slide 6
Kevin Lewis » @_phzn » @vonagedev
Slide 7
Kevin Lewis » @_phzn » @vonagedev
Slide 8
Kevin Lewis » @_phzn » @vonagedev
Slide 9
Kevin Lewis » @_phzn » @vonagedev
Slide 10
Kevin Lewis » @_phzn » @vonagedev
Slide 11
Kevin Lewis » @_phzn » @vonagedev
Slide 12
Kevin Lewis » @_phzn » @vonagedev
Slide 13
Kevin Lewis » @_phzn » @vonagedev
Slide 14
Kevin Lewis » @_phzn » @vonagedev
Slide 15
Slide 16
Kevin Lewis » @_phzn » @vonagedev
Slide 17
Kevin Lewis » @_phzn » @vonagedev
Slide 18
APIs provide a contract between the company providing it and a developer. If you request data in the correct way, you should receive a response. Kevin Lewis » @_phzn » @vonagedev
Slide 19
Ingredients in an API Request
Kevin Lewis » @_phzn » @vonagedev
Slide 20
HTTP Method Type of request
Kevin Lewis » @_phzn » @vonagedev
Slide 21
Kevin Lewis » @_phzn » @vonagedev
Slide 22
Kevin Lewis » @_phzn » @vonagedev
Slide 23
! Ingredients ✅ HTTP Method - GET, POST, etc
Kevin Lewis » @_phzn » @vonagedev
Slide 24
Endpoints URL for the request
Kevin Lewis » @_phzn » @vonagedev
Slide 25
Kevin Lewis » @_phzn » @vonagedev
Slide 26
Kevin Lewis » @_phzn » @vonagedev
Slide 27
! Ingredients ✅ HTTP Method - GET, POST, etc Endpoint - a URL
Kevin Lewis » @_phzn » @vonagedev
Slide 28
Lets make an API request lws.io/apis-1
Kevin Lewis » @_phzn » @vonagedev
Slide 29
Getting data from an API axios.get(“https://yougotthis.io/talks-flat.json”) .then(function(response){ console.log(response.data) })
Kevin Lewis » @_phzn » @vonagedev
Slide 30
! Ingredients ✅ HTTP Method - GET, POST, etc Endpoint - a URL
Kevin Lewis » @_phzn » @vonagedev
Slide 31
Body
A set of data sent with the request
Kevin Lewis » @_phzn » @vonagedev
Slide 32
Example bodies • Message content • Files to upload • New user information • Phone number to call
Kevin Lewis » @_phzn » @vonagedev
Slide 33
api.lws.io
Kevin Lewis » @_phzn » @vonagedev
Slide 34
Lets send a POST request lws.io/apis-2
Kevin Lewis » @_phzn » @vonagedev
Slide 35
! Ingredients ✅ HTTP Method - GET, POST, etc Endpoint - a URL Body - data to send with request
Kevin Lewis » @_phzn » @vonagedev
Slide 36
Headers
Additional info, often including authentication
Kevin Lewis » @_phzn » @vonagedev
Slide 37
! Ingredients ✅ HTTP Method - GET, POST, etc Endpoint - a URL Body - data to send with request Headers - additional info & settings
Kevin Lewis » @_phzn » @vonagedev
Slide 38
NOT EVERY API IS THE SAME.
READ THE DOCS. Kevin Lewis » @_phzn » @vonagedev
Slide 39
Kevin Lewis » @_phzn » @vonagedev
Slide 40
Kevin Lewis » @_phzn » @vonagedev
Slide 41
Kevin Lewis » @_phzn » @vonagedev
Slide 42
Kevin Lewis » @_phzn » @vonagedev
Slide 43
Kevin Lewis » @_phzn » @vonagedev
Slide 44
HTTP Status Codes
Comes with response and gives indication of overall result
Kevin Lewis » @_phzn » @vonagedev
Slide 45
HTTP Status Codes Code Range
Meaning
200
Here is the data
401
Not authorized
404
Does not exist
Kevin Lewis » @_phzn » @vonagedev
Slide 46
Kevin Lewis » @_phzn » @vonagedev
Slide 47
APIs describe a set of instructions that developers can use to interact with a platform.
Kevin Lewis » @_phzn » @vonagedev
Slide 48
Requests always have a method and endpoint. They may also have a body and headers.
Kevin Lewis » @_phzn » @vonagedev
Slide 49
Responses have a HTTP status code, and almost always a body.
Kevin Lewis » @_phzn » @vonagedev
Slide 50
Language SDKs Kevin Lewis » @_phzn » @vonagedev
Slide 51
Kevin Lewis » @_phzn » @vonagedev
Slide 52
Kevin Lewis » @_phzn » @vonagedev
Slide 53
dashboard.nexmo.com COUPON ONLY SHOWN LIVE €10 of credit - coupon expires March 31 2021
Kevin Lewis » @_phzn » @vonagedev
Slide 54
Lets use the Vonage Server SDK for Node.js lws.io/apis-3 Kevin Lewis » @_phzn » @vonagedev
Slide 55
Kevin Lewis » @_phzn » @vonagedev
Slide 56
What are some common features of API pricing? Kevin Lewis » @_phzn » @vonagedev
Slide 57
Kevin Lewis » @_phzn » @vonagedev
Slide 58
Kevin Lewis » @_phzn » @vonagedev
Slide 59
Authenticated Requests Kevin Lewis » @_phzn » @vonagedev
Slide 60
Kevin Lewis » @_phzn » @vonagedev
Slide 61
Kevin Lewis » @_phzn » @vonagedev
Slide 62
Kevin Lewis » @_phzn » @vonagedev
Slide 63
What we covered • What are APIs? • What goes into an API request? • What are SDKs • Rate limiting, pricing structures, authenticated requests
Kevin Lewis » @_phzn » @vonagedev
Slide 64
Thank you! Kevin Lewis - @_phzn Kevin Lewis » @_phzn » @vonagedev