HTML - "Hyper Text Markup Language" HTTP - "Hyper Text Transfer Protocol"
https://www.w3.org/WhatIs.html https://www.merriam-webster.com/dictionary/hypertext - see etymology
Request & Response Framework
http://slides.com/dhrumilmehta/how-to-tell-a-story-with-data-tools-of-the-trade#/6/4
http://slides.com/dhrumilmehta/how-to-tell-a-story-with-data-tools-of-the-trade#/6/5
- HTTP is on the "application layer" of the OSI stack
- It assumes a reliable transport layer protocol (like TCP/IP)
- But maybe these acronyms are all TMI...point being - HTTP is an abstraction at the application layer
http://www.w3schools.com/tags/ref_httpmethods.asp
-
GET - when you navigate to a website like
www.google.com
you're issuing a get request to google's servers. Their server then sends you back the google homepage. -
POST - when you fill out the google search for and hit "Search", you're issuing a "POST" request. POST requests contain a payload in the body that is not visible in the URL. That is why it is most often used to send form data to a website.
-
HEAD, PUT, DELETE ... and some others
GET | POST |
---|---|
Requests data from a specific resource | Submits data to be processed by a specific resource. |
Data is submitted as part of the URL | Data is submitted in the request body |
Less secure but faster | More secure but slower |
Can be cached by browser | Not Cached by Browser |
Length Limited by URL size | MaxLength determined by server |
So what is being "got" when you GET?... A Resource!
You'll read a little more about REST-ful webpages in your homework tonight. For now, I want to just show you an example of a REST-ful web app. Regardless of what is going on behind the scenes, a layer of REST-ful abstraction can help things make sense to an outside consumer of your content.
- Demo of the polls database.
- Note how the URL (Universal Resource Locator) refers to a "resource".
- I can GET a resource or list of resources, or I can POST to an endpoint which can trigger the creation of a resource.
- Any kind of request can be programmed to do any kind of thing (for example POST requests can also trigger scraping in the polls database), but a well formed REST-ful web applicaiton will stick to conventions.
A source once said to me:
The government is just as series of CRUD applications that interact with each other.
"CRUD apps" have four functions: Create Read Update Delete resoures. Understanding the concept of a CRUD app can help you understand REST and HTTP verbs a little better.
- Back End
- Front End
Let's spin up a simple CRUD APP!
- Create an Ubuntu EC2 instance on Amazon Web Services (AWS) and SSH into it
- Host the "back end"
- open the INSOMNIA app to make an http GET request to the "back end"
- in the INSOMNIA app to make a http POST request to the "back end"
- spin up the "front end" locally and point to the new "back end"