Our end goal of this workshop was to send a text message 24 hours before it rains in New York City. First, they worked with the Twilio SMS API, https://www.twilio.com/docs/api/rest, and sent a text message. They learned how to test an API with Postman, https://www.getpostman.com/,. Second, they incorporated the Weather API, https://openweathermap.org/api, to trigger an if/else response.
9. AGENDA
1. What is an API – API, endpoint, method
2. Make a call to Postman
3. Weather API
4. How to read through documentation
5. Twilio SMS API
6. Twilio SMS and Weather API combo!
OMG you’ve built an application! You can now call an API using Postman!
13. SETUP:
1.Go to Weather API (www.openweathermap.org)
1. Sign up and sign in
2.Go to Twilio API (www.twilio.com)
1. Sign up and sign in (if you already have an account, you will need to insert your credit
card)
2. Verify your phone number
3.Go to Postman (www.getpostman.com)
1. Download Chrome/Mac app
2. Sign up and in
14. WHO IS ELIZABETH?
• Currently:
– Product Advisor at Pluto, Diversity+Inclusion
Tool
– Product Advisor at Streetmix, Urban Designing
tool
– Product Manager at American Express
– Co-founder Women Who Code NYC
• Previously:
– Entrepreneur in Residence for Civic Hall
– Head of Product for API Management startup
– Software Eng at Time Inc media company
• Twitter: @musingMurmurs
• Medium: @musingmurmurs
• LinkedIn: /in/elizabethferrao/
DONUTS!
medium.com/@musingmurmurs/do
nuts-1e731443ca94
15. DISCLAIMER
• I’m NOT an expert on APIs or Postman!
• Postman’s UI is so easy that I can pick it up and use it for casual use
• Twilio’s APIs make it ridiculously easy to do basic SMS stuff (if you forget, they have a
5min refresher tutorial!)
• OpenWeather API is so basic that I don’t get lost in all the weather options
16. ACCOLADES TO HUMANS YOU SHOULD FOLLOW
I want to highlight the awesome people behind the tools we’re using and the people who’ve helped
me get set up.
@GreggyB
Award: Most Twilio
Awesomeness
@ShachyJR
Award: Most API
debugging
@KaseyByrne
Award: Most
Postman Awesomeness
@Angadrey
Award: Most Helpful
Preparation
17. BY THE END…
• You will be have a comprehensive understanding of
APIs
• You will have called 2 APIs
• You will have Google searched 3 queries
"Give a woman a fish and she eats
for a day. Teach a woman
to fish and she eats for a lifetime."
18. WHAT IS AN API?
• Free Code Camp - https://medium.freecodecamp.org/what-is-an-api-in-english-please-
b880a3214a82
• Types of APIs: REST, SOAP
• Documenting REST APIs: https://swagger.io/docs/specification/basic-structure/
• Common gruntles against APIs:
– documentation isn’t updated
– API is down - many APIs have Status pages https://status.twilio.com/,
https://status.aws.amazon.com/
19. WHAT CAN AN API DO?
• Can request information – GET request
• Can send information – POST request
• New FULL information (update entire info) – PUT request
• New PARTIAL information (update only part of info) – PATCH
request
• Can delete information – DELETE request
20. COMMON TERMS - AUTHENTICATION
• Authentication key
• None – Weather API
• Basic Auth (username/password) – Twilio API
• Oauth 1.0 (2006-2012)
• Oauth 2.0 (2012+)
21. HOW TO USE POSTMAN
• Quick look through of Postman
22. WEATHER API
Go to https://openweathermap.org
>Let’s go play around!
1. Request “Current Weather Data” by clicking
an example call
1. Is that response - Yaml or Json?
23. WEATHER API IN POSTMAN
1. Paste an example URL in Postman -
api.openweathermap.org/data/2.5/weather
2. AT THE END – add the city ?q=London
3. AT THE END – add &appid= AND authentication key (ex:
5060f60e000a934875ec)
1. To find auth key, go to https://openweathermap.org/current
2. Click “Sign in”
3. Profile header includes “API Keys” > copy and paste that
Full URL will look like:
api.openweathermap.org/data/2.5/weather?q=London&appid=5060f60e00
0a934875ec
24. HOW TO READ A RESPONSE
• Google search “How to read
JSON”!
>https://www.google.com/search?q=how+to+read+json&oq=how+to+read+json&aqs=c
hrome..69i57j0l5.2376j1j1&sourceid=chrome&ie=UTF-8
25. SO…WHAT DID WE JUST DO?
• Let’s cross-reference this awesome article on
APIs https://restful.io/an-introduction-to-api-s-
cee90581ca1b
27. TWILIO API INGREDIENTS
In your fav notes app, compile these 5 Ingredients:
1. (Programmable SMS > Learn and Build) Curl URL – ex:
https://api.twilio.com/2010-04-
01/Accounts/ACa37c6d30a2f5c/Messages.json
2. (Programmable SMS > Learn and Build) Twilio Number – ex: +1415-214-
8911
3. (Programmable SMS > Learn and Build) Real Phone Number – ex: +1-305-
814-7036
4. (Twilio Account Dashboard) Account SID - ex: ADsk83a9dsjfsd61c67uioc
5. (Twilio Account Dashboard) Auth Token - ex: c80cdsdfjkldsjfklsde374eb1
28. TWILIO API INTO POSTMAN –
GET REQUEST
1. Curl URL into Request box
2. Basic Auth
1. Username is Account SID
2. Password is Auth Token
3. Press SEND
29. TWILIO API INTO POSTMAN –
POST REQUEST
1. Curl URL into Request box
2. Basic Auth
1. Username is Account SID
2. Password is Auth Token
3. HEADERS > Content-type = application/x-www-form-urlencoded
4. HEADERS > Authorization = Basic Qsdjfkldsjkldsfjs
5. BODY > check x-www-form-urlencoded (NOT form-data)
1. In “New Key”, enter “To” : In ”Value” enter real phone number
2. In “New Key”, enter “From” : In ”Value” enter Twilio phone
number
3. In “New Key”, enter “Body” : In ”Value” enter “my first text
message from Postman!”
31. WEATHER AND TWILIO API
1.Copy any property of the method you just
called
2.Paste that into the body and SEND!
32. WANT TO LEARN MORE?
• Play around with calling more Twilio and Weather APIs!
• Try calling another API! https://www.programmableweb.com/apis/directory
– If working from the command line/Postman, a CURL link will be your request
• Homework: Try a Twilio Quickstart tutorial https://www.twilio.com/docs/sms/api
• Follow http://apievangelist.com/
Questions? DM me @MusingMurmurs
33. REQUEST:
TWEET 1 LEARNING, 1 PIC OF YOUR PROJECT, AND TAG
THEM! (AND ME @MUSINGMURMURS)
@GreggyB
Award: Most Twilio
Awesomeness
@ShachyJR
Award: Most API
debugging
@KaseyByrne
Award: Most
Postman Awesomeness
@Angadrey
Award: Most Helpful
Preparation
34. Part-time Product Management Courses in
San Francisco, Silicon Valley, Los Angeles, New York, Austin,
Boston, Seattle, Chicago, Denver, London, Toronto
www.productschool.com