A presentation at codebar Festival by Kevin Lewis
An Introduction to APIs Kevin Lewis - Developer Advocate, Vonage Kevin Lewis » @_phzn » @vonagedev
Hi! I’m Kevin & I work for Vonage Integrate voice, video & messaging with our cloud communications platform. Kevin Lewis » @_phzn » @vonagedev
You Got This Conferences Community events focusing on core skills needed for a happy, healthy work life. Kevin Lewis » @_phzn » @vonagedev
Kevin Lewis » @_phzn » @vonagedev
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
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
Ingredients in an API Request Kevin Lewis » @_phzn » @vonagedev
HTTP Method Type of request Kevin Lewis » @_phzn » @vonagedev
! Ingredients ✅ HTTP Method - GET, POST, etc Kevin Lewis » @_phzn » @vonagedev
Endpoints URL for the request Kevin Lewis » @_phzn » @vonagedev
! Ingredients ✅ HTTP Method - GET, POST, etc Endpoint - a URL Kevin Lewis » @_phzn » @vonagedev
Lets make an API request lws.io/apis-1 Kevin Lewis » @_phzn » @vonagedev
Getting data from an API axios.get(“https://yougotthis.io/talks-flat.json”) .then(function(response){ console.log(response.data) }) Kevin Lewis » @_phzn » @vonagedev
Body A set of data sent with the request Kevin Lewis » @_phzn » @vonagedev
Example bodies • Message content • Files to upload • New user information • Phone number to call Kevin Lewis » @_phzn » @vonagedev
api.lws.io Kevin Lewis » @_phzn » @vonagedev
Lets send a POST request lws.io/apis-2 Kevin Lewis » @_phzn » @vonagedev
! Ingredients ✅ HTTP Method - GET, POST, etc Endpoint - a URL Body - data to send with request Kevin Lewis » @_phzn » @vonagedev
Headers Additional info, often including authentication Kevin Lewis » @_phzn » @vonagedev
! Ingredients ✅ HTTP Method - GET, POST, etc Endpoint - a URL Body - data to send with request Headers - additional info & settings Kevin Lewis » @_phzn » @vonagedev
NOT EVERY API IS THE SAME. READ THE DOCS. Kevin Lewis » @_phzn » @vonagedev
HTTP Status Codes Comes with response and gives indication of overall result Kevin Lewis » @_phzn » @vonagedev
HTTP Status Codes Code Range Meaning 200 Here is the data 401 Not authorized 404 Does not exist Kevin Lewis » @_phzn » @vonagedev
APIs describe a set of instructions that developers can use to interact with a platform. Kevin Lewis » @_phzn » @vonagedev
Requests always have a method and endpoint. They may also have a body and headers. Kevin Lewis » @_phzn » @vonagedev
Responses have a HTTP status code, and almost always a body. Kevin Lewis » @_phzn » @vonagedev
Language SDKs Kevin Lewis » @_phzn » @vonagedev
dashboard.nexmo.com COUPON ONLY SHOWN LIVE €10 of credit - coupon expires March 31 2021 Kevin Lewis » @_phzn » @vonagedev
Lets use the Vonage Server SDK for Node.js lws.io/apis-3 Kevin Lewis » @_phzn » @vonagedev
What are some common features of API pricing? Kevin Lewis » @_phzn » @vonagedev
Authenticated Requests Kevin Lewis » @_phzn » @vonagedev
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
Thank you! Kevin Lewis - @_phzn Kevin Lewis » @_phzn » @vonagedev
View Introduction to APIs on Notist.
Dismiss
Learn more about what APIs are, how they’re built, and how to use them. This workshop will happen in JavaScript, but you don’t need to know much to take part.