Advertisement
yo2man

Notes on How Do We Get Data from the Web Treehouse

Jul 5th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. APIs lesson notes
  2.  
  3. URI ~ URL
  4. RESTful services = API that is on the web, ie: forecast.io
  5.  
  6. Definitions:
  7.  
  8. HTTP: HyperText Transfer Protocol
  9. GET: Retrieve data from the network
  10. POST: Create new data over the network
  11. CRUD: Create/Retrieve/Update/Delete
  12.  
  13.  
  14. API vs SDK => API operates in an Software Development Kit
  15.  
  16. // Modern programming involves adding layers of abstraction that make it easier for us to concentrate on the higher level tasks we are concerned with. Simple.
  17.  
  18. We are about to request forecast data, and we will do so
  19. with something called an HTTP GET request.
  20. At its heart, programming is really about working with data.
  21. Working with data has four basic operations, creating data,
  22. retrieving it once its been created, updating it, and of course deleting it.
  23. You will often hear these basic operations referred to by their acronym, CRUD.
  24.  
  25. Most web programming primarily deals with two of these operations, post and get.
  26. We aren't worried about posting any data at this point,
  27. since we are not creating a weather forecast.
  28.  
  29. And that leaves us with get,
  30. which is the basic web operation to retrieve data from a server.
  31.  
  32. Every time we visit a website, our browser issues HTTP get requests to request the latest version of the webpage,
  33.  
  34. We are going to make an HTTP get request to the forecast servers.
  35. We specify exactly what we are requesting using the unique
  36. URI from the developer documentation.
  37. The server then sends us a response, which includes the weather data.
  38. It's up to us to handle this response and
  39.  
  40. parse through the data to use it in our ad.
  41.  
  42. If we go back to a regular browser example, the server sends back HTML, and
  43. the browser converts it into the webpage that we view.
  44.  
  45. As you might expect, getting data from the web is easier said than done.
  46.  
  47. To accomplish it, we're going to have to learn how to create a web request,
  48. send it, receive a response, and handle the response, or error.
  49. On top of all that, we need to perform these types of request in the background, to ensure that our app remains responsive to actions from the user.
  50.  
  51.  
  52.  
  53. // https://teamtreehouse.com/library/build-a-weather-app/networking/how-do-we-get-data-from-the-web
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement