Example 1: http response status codes
HTTP response status codes
HTTP response status codes indicate whether a specific HTTP request has been successfully completed.
Responses are grouped in five classes:
1. Informational responses (100–199)
2. Successful responses (200–299)
3. Redirects (300–399)
4. Client errors (400–499)
5. Server errors (500–599)
1. Information responses
a. 100 Continue
b. 101 Switching Protocol
c. 102 Processing (WebDAV)
d. 103 Early Hints
2. Successful responses
a. 200 OK
b. 201 Created
c. 202 Accepted
d. 203 Non-Authoritative Information
e. 204 No Content
f. 205 Reset Content
g. 206 Partial Content
h. 207 Multi-Status (WebDAV)
i. 208 Already Reported (WebDAV)
j. 226 IM Used (HTTP Delta encoding)
3. Redirection messages
a. 300 Multiple Choice
b. 301 Moved Permanently
c. 302 Found
d. 303 See Other
e. 304 Not Modified
f. 305 Use Proxy
g. 306 unused
h. 307 Temporary Redirect
i. 308 Permanent Redirect
4. Client error responses
a. 400 Bad Request
b. 401 Unauthorized
c. 402 Payment Required
d. 403 Forbidden
e. 404 Not Found
f. 405 Method Not Allowed
g. 406 Not Acceptable
h. 407 Proxy Authentication Required
i. 408 Request Timeout
j. 409 Conflict
k. 410 Gone
l. 411 Length Required
m. 412 Precondition Failed
n. 413 Payload Too Large
o. 414 URI Too Long
p. 415 Unsupported Media Type
q. 416 Range Not Satisfiable
r. 417 Expectation Failed
s. 418 I'm a teapot
t. 421 Misdirected Request
u. 425 Too Early
v. 426 Upgrade Required
w. 428 Precondition Required
x. 429 Too Many Requests
y. 431 Request Header Fields Too Large
z. 451 Unavailable For Legal Reasons
5. Server error responses
a. 500 Internal Server Error
b. 501 Not Implemented
c. 502 Bad Gateway
d. 503 Service Unavailable
e. 504 Gateway Timeout
f. 505 HTTP Version Not Supported
g. 506 Variant Also Negotiates
h. 507 Insufficient Storage (WebDAV)
i. 508 Loop Detected (WebDAV)
j. 510 Not Extended
k. 511 Network Authentication Required
Example 2: http status codes
Some important http status codes are:
200: The one you will mostly want to get. Succesful transfer
301: Moved Permanently. 300 defines Redirections
404: Not found. 400: bad requests as 401 Unauthorized and 403 Forbidden.
502: Bad Gateway. 500 defines Internal Server Errors.
Example 3: 200 error code
The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default. The meaning of a success depends on the HTTP request method: GET : The resource has been fetched and is transmitted in the message body.
from developer.mozilla.org
Example 4: http response
resource HTTP response method is made up of three
components:
Response Status Code ==> 200, 301, 404, 500
(these are the most common ones)
Response Header Fields ==> Date, Server, LastModified, Content-Type
Response Body ==> This is the data that comes
back to the client from the server.
Example 5: http request and http response
HTTP request method is made up of four components:
Request Method ==> Get, Post, Put, Delete (these are
the common ones)
Request URL ==> the URL of the resource
Request Header ==> Accept-Language, AcceptEncoding, User-Agent, Host
Request Body ==> This is the data to be sent to the
HTTP RESPONSE
resource HTTP -RESPONSE- method is made up of three
components:
Response Status Code ==> 200, 301, 404, 500
(these are the most common ones)
Response Header Fields ==> Date, Server, LastModified, Content-Type
Response Body ==> This is the data that comes
back to the client from the server.
Example 6: request response
REQUEST :(request url,http methods,header,query param, param,body,cookie)
1-)Request Url where we have Endpoint (domain:Port/Endpoints)
2-)HTTP METHODS(Get, Post, Put, Patch, Delete, Header)
Get: For to retrieve resources from the server
Post: to send or add resource to the server
Put: For update the resources in the server
Patch: For partial update the resource
Delete: For deleting the resource in the server
Head: To get header from the response not the body
3-)HEADER is metadata is about the request,
basically providing more information along
with the request.
-Content Type header : to specify what kind of
data we are sending to the server
-Accept Header : to specify what kind of data
format you want to get in the response like (json or xml)
-Authorization header : used to provide the
Bearer token in many api's.
4-)Query Parameter: A key value pair usually
for filtering result
5-)Parameter: for identifying single resource
among the list of resources.
6-)Payload(BODY): for POST,PUT,PATCH request
(json,xml,plainText,URL encoded for data)
7-)Cookie
RESPONSE :(STATUS CODE,PAYLOAD(body),HEADER,COOKIE,
TIME(spent to get response))
1-Status Code:
2xx - Success
4xx - Client Error
5xx - Server Error
2-Payload(Body) :
The actual resource we got from the server.
Content type can be : plain text, json, xml, html, json etc.
3- Metadata about response to provide more information
4- Cookie
5- Time for getting spended time for the response