IST256 : Applications Programming for Information Systems The HTTP Protocol and Web Services
Agenda Connection Activity Teaching: Practice Activities (3) Attendance Teaching: HTTP Web Services Practice Activities (3) Thursday
9901 Connect Activity https://goo.gl/TJOuaW Sign in with your NetID and Password Enter Today’s PIN 9901
HTTP The Protocol of The Web When you type a URL into your browser you’re making a request. The site processing your request sends a response. Part of the response is the status code. This indicates “what happened” The other part of the response is content (HTML) which is rendered by the browser. HTTP is a text based protocol.
Watch Me Code A Non-Python Demo of HTTP What happens when you request a site? Like syr.edu? Short and sweet demo
What is a Web API? An API is short for Application Programming Interface. A Web API uses HTTP Protocol to communicate with your program. Web API’s can return data in many formats. We’ll focus on the JSON (JavaScript Object Notation) format which converts easily to Python lists and dictionaries.
Watch Me Code Google’s Geocoding API Get a GPS coordinate (Latitude and Longitude) for a City or Street Address HTTP GET: http://maps.googleapis.com/maps/api/geocode/json?address=addr Short and sweet demo
Web API: Weather Forecasting https://darksky.net/dev Darksky.net / Forecast IO Sign up for an API key 1000 free requests / day
Watch Me Code Let’s Continue Our Geocode Example: Get Current weather for Lat/Lng Refactor as a function Write a program to ask for a location, show current conditions for location! Short and sweet demo
Other Web API’s https://itunes.apple.com/search?term - iTunes Search https://swapi.co/ - Star Wars API https://www.omdbapi.com/ - Movie Database API http://www.pokeapi.co/ - Pokemon API http://open-notify.org/ - Space API http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojs on.php - Earthquake API
Help me Code Let’s write a program to ask you for a sub-Reddit and then print the titles of the top stories in that sub-Reddit Example API Call: (news) sub-Reddit https://www.reddit.com/r/news/top.json First we get it to work with this url Then let’s write the full program
Your “Ticket Out” Conclusion Activity http://bit.ly/2eBCPM7 The activity will be effort graded.