Basics of HTTP requests - Learn Online

Basics of HTTP requests

Lesson Details:
July 21, 2020

Video Transcription: Let us spend some more time to  understand what HTTP or the hypertext  Transfer Protocol actually is this video  is brought to you by Appy Pie’s Academy so  now whenever we are looking at HTTP it  essentially is a way to get information  from a server or to establish  communication between two different  points so now whenever you look at an  HTTP or hypertext Transfer Protocol then  essentially you can notice that it is  always a request or and response based  process okay so over here you have one  particular server which makes a request  on to a different machine and then the  other machine caters some response back  to this particular machine so unless you  make a request you will not get a  response and this is the fundamental  working principle of HTTP so now in HTTP  there are a lot of different types of  requests but the main two different types of requests which are used are get  and post request  okay so a get request is used when you  just want to get some data from the  server a post request is used when you  want to give some data back to the  server and whenever you want to specify some parameters inside this particular request then the parameters are bundled  inside the main URL and the entire thing  is given back as a get request so now  over here whenever we get any type of  response from an HTTP server it  essentially has the following  characteristics or the following objects  the first one is a status code and that  actually tells you about how successful  the data how successful you were from  getting the data from the server so  there is a famous error called us for 0.

4 which means that the page was not  so that is a line which will be sent on  to this particular status line okay so  after that we have the response header  and the response header contains a lot  of different properties which the  website wants your computer to be  accustomed to so something like the  cookies or the date of the request or  the time of the request followed by what  requests you have done and if you have  some specific objects established as do  not crack knee or something of that sort  and all of these things are given back  to your computer from the response  header and then after the response  header you have a blank line and then  after this blank line you have an  optional message body so this is  essentially how a request is made using  HTTP to any server and this is how you  get a response so now let's look at a  real life example where we will be  giving in a get request to Google and  let's see what response do we get so to  do this we are using an app called as  postman this app is open source and it  lets you make requests very easily so  over here we have a get request and this  get request is basically being made to so over here you can also see  that different types of HTTP requests.

So we have get post put patch delete copy  head options link unlink purge and all  of that so over here let's make a get  request to so over here this  is the response which we have received  okay and this may not look very pretty  right now but if you look at the preview  section then this is essentially how it  looks over here you also have the Google  logo which is not being displayed right  now but essentially this is how the  entire thing looks and this is the raw  data which we get from Google so this is  the only thing which we get and your  browser reconstructs the entire webpage  based on this particular response  so over here if you look at the response  you first of all have a lot of different  header files then you have the style and  then you have the HTML followed by some  JavaScript over here okay and over here  things can also be a lot complicated as  in in the unlock section of this  particular course where we'll be  designing a decentralized Dropbox clone  we are going to be creating a JavaScript  file and onto that javascript file we  are then going to convert it onto a  different type of file which is around  200,000 lines long so similarly we'll be  getting a lot of different content  specially JavaScript content on this  particular response tag and over here if  you look at the response you can  essentially see that there are a lot of  different aspects to it so if we look at  the headers of this particular response  or the body or the pre request tag then  you can see that we are getting a lot of  different things and this is essentially  the point which I wanted to get across  about HTTP which is that it is very good  while doing network communication  because it has all of these things built  in like the status line then the  response header and all of these things  can together make the web experience a  little bit better and yes that is pretty  much it about HTTP it is used to  communicate data in between two or more  nodes and while communicating that data you have a certain protocol which is followed and the rules of that  particular protocol are mentioned over  here which has a status line then a response header which contains some important information about that particular data piece which you are getting back then we have a blank line and then we have the optional message body and the reason the message body is  optional see if you look at an HTTP request then the whole point of making the request is to get some data back  then why is this particular thing  optional well that is because sometimes  you just want to check the health of the  server  and what I mean by the health of the  server is basically you want to check if  the server is online or not.

Whenever you want to do this you just put a get request where you don't get any message out of it but you only get a response header which tells you that the server is alive and it is giving you back at least relevant information or relevant data packets so yes that is pretty much it about HTTP and now that we have established a strong foundation of what  HTTP actually is so now let's focus on what are the problems we are currently facing with HTTP and what are some future problems which we can also face with HTTP and how we can integrate ipfs and we can create strong and robust web applications by using decentralization.

Course content