‫Welcome back.
‫In this video, I want from you to focus with me because I'm going to explain very important concepts,
‫the requests and the responses in Http.
‫Http hypertext transfer protocol is the foundation of data communication on the World Wide Web.
‫It's a protocol used for transferring data between a client, typically a web browser or an application,
‫and a server where websites and web services are hosted.
‫Http involves two fundamental components, requests and responses.
‫Let's start with the Http request.
‫The request begins with an Http method which indicates the action the client wants to perform.
‫Common methods include get and post get to retrieve data from the server and requests.
‫Using.
‫Get should only retrieve data and should have no other effect on the data post.
‫A post request is used to send data to the server, for example, customer information, file upload
‫and etcetera using HTML forms.
‫Sending data to the server by using post method often used for submitting forms or creating new resources.
‫Let's move to the Http response.
‫An Http response is made by a server to a client.
‫The aim of the response is to provide the client with the resource it requested or inform the client
‫that the action it requested has been carried out, or else to inform the client that an error occurred
‫in processing its request.
‫An Http response contains a status line, a series of Http headers or header fields, a message body
‫which is usually needed.
‫The status line.
‫The response starts with an Http status code, a three digit number that indicates the outcome of the
‫request.
‫Common status code includes 200, which is okay.
‫The request was successfully and the server is returning data 404 not found.
‫The requested resource could not be found on the server 500 internal server error.
‫An error occurred on the server while processing the request and others like 201 created for one unauthorized
‫and etcetera.
‫Now let's move to learn about the Http query.
‫Http queries refer to the use of query parameters in Http requests.
‫Query parameters are key value pairs added to the end of a URL to customize and specify the details
‫of an Http request.
‫These parameters are separated from the base URL by a question mark and from each other by ampersand
‫to append query params or parameters to the end of a URL.
‫A question mark is added, followed immediately by a query parameter.
‫So for example, in this case this is our base URL.
‫This is the start of parameters.
‫I added this question mark.
‫The key is color equals sign, the value which is blue.
‫So depending on the server's API, query parameters can be used for various purposes such as filtering,
‫searching, sorting and pagination.
‫We'll use it in pagination filtering and sorting in our application.
‫This and sign.
‫I'm specifying a new key which is sort equals to newest.
‫Here I am filtering and requesting the newest responses so as you can see you can include multiple query
‫parameters in a single request.
‫By separating them with ampersands.
‫Each parameter adds a specific instruction or criteria to for the server to follow when processing the
‫request.
‫You can see another example here.
‫The key and in general formula is key one equal value, one key, two equal value two.
‫This is the separator between the parameters and this is the start where the query string begins.
‫Now let's jump to the tmdb.org API and let's understand the Http request response and the http query
‫parameters.