HTTP Flashcards

1
Q

Explain HTTP in as much detail as you can.

A

HTTP stands for HyperText Transfer Protocol. It is a protocol for fetching resources such as HTML documents. HTTP can be used to control several things, for example authentication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the request-response cycle in HTTP?

A

The request-response cycle involves communication between the browser (client) and server.
1. User issues URL from a browser (client).
2. Browser (client) sends an HTTP request message to the server.
3. Server reads the HTTP request and generates an HTTP response.
4. Server returns a response message.
5. Browser (client) reads the HTTP response and displays the data for the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the purpose of status codes in HTTP, what types of codes there are and when to use each one.

A

The purpose of status codes in HTTP is to indicate whether a specific HTTP request has been successfully completed. Responses are grouped in 5 classes:
1. Informational responses (100-199)
2. Successful responses (200-299)
3. Redirection messages (300-399)
4. Client error responses (400-499)
5. Server error responses (500-599)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain HTTP response code 200.

A

200 (OK) - The request succeeded.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain HTTP response code 201.

A

201 (CREATED) - The request succeeded and a new resource was created as a result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain HTTP response code 202.

A

202 (ACCEPTED) - The request has been received but not yet acted upon.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain HTTP response code 204.

A

204 (NO CONTENT) - There is no content to send for this request, but the headers may be useful.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain HTTP response code 400.

A

400 (BAD REQUEST) - The server cannot or will not process the request due to something that is perceived to be a client error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain HTTP response code 404.

A

404 (NOT FOUND) - The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

List the HTTP-Methods.

A

The HTTP-Methods are GET, POST, PUT, PATCH and DELETE.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain HTTP-Method GET.

A

A: GET - used to retrieve data from a web server. Used in PHP to retrieve information from a database, such as a user profile or product catalog. A GET request is typically sent via a URL. GET response codes: 200 (OK), 400 (BAD REQUEST), 404 (NOT FOUND).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain HTTP-Method POST.

A

POST - is used to send data to a web server. It is used in PHP to create or modify information in a database, such as creating a user account or updating a product listing. A POST request is usually sent via an HTML form and the data is sent in the form of an HTTP body.
POST response codes: 200 (OK), 201 (Created), 204 (No Content).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain HTTP-Method PUT.

A

PUT - used primarily to update an existing resource. If the resource does not exist, the API may decide to create a new resource or not.
PUT response codes: 200 (OK), 201 (Created), 204 (No Content).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain HTTP-Method PATCH.

A

PATCH - is used to modify the values of the resource properties. Similar to PUT.
PATCH response codes: 200 (OK), 204 (No Content), 400 (Bad Request).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain HTTP-Method DELETE.

A

DELETE - used to delete resources (identified by the request-URI).
DELETE response codes: 200 (OK), 202 (Accepted), 204 (No Content).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly