Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- APIs lesson notes
- URI ~ URL
- RESTful services = API that is on the web, ie: forecast.io
- Definitions:
- HTTP: HyperText Transfer Protocol
- GET: Retrieve data from the network
- POST: Create new data over the network
- CRUD: Create/Retrieve/Update/Delete
- API vs SDK => API operates in an Software Development Kit
- // 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.
- We are about to request forecast data, and we will do so
- with something called an HTTP GET request.
- At its heart, programming is really about working with data.
- Working with data has four basic operations, creating data,
- retrieving it once its been created, updating it, and of course deleting it.
- You will often hear these basic operations referred to by their acronym, CRUD.
- Most web programming primarily deals with two of these operations, post and get.
- We aren't worried about posting any data at this point,
- since we are not creating a weather forecast.
- And that leaves us with get,
- which is the basic web operation to retrieve data from a server.
- Every time we visit a website, our browser issues HTTP get requests to request the latest version of the webpage,
- We are going to make an HTTP get request to the forecast servers.
- We specify exactly what we are requesting using the unique
- URI from the developer documentation.
- The server then sends us a response, which includes the weather data.
- It's up to us to handle this response and
- parse through the data to use it in our ad.
- If we go back to a regular browser example, the server sends back HTML, and
- the browser converts it into the webpage that we view.
- As you might expect, getting data from the web is easier said than done.
- To accomplish it, we're going to have to learn how to create a web request,
- send it, receive a response, and handle the response, or error.
- 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.
- // 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