05 - HTTP Methods, Status Codes, & Headers Flashcards
indicates the desired action for the specified resource
method
methods are sometimes called ____
http verbs
POST is designed to cover 4 functions
- annotation of existing resources
- posting a message
- providing a block of data
- extending a database
identical to a response to a GET request but without the response body
HEAD
used for checking link validity, recent modification, or to find out more about a resource
HEAD
replaces current resource in the specified path with the data in the request body
PUT
deletes the resource in the specified path
DELETE
used to establish a connection to the server over a tunnel proxy
CONNECT
used to echo the contents of an HTTP request back to the client
TRACE
useful for checking how the request is modified by proxies
TRACE
used to ask the server about its supported methods
OPTIONS
used to apply partial modification to the data in the specified URL
PATCH
what are the CRUD representation of the HTTP methods
create: put
read: get
update: post/patch
delete: delete
characteristics of http methods (3)
safe
idempotent
cacheable
do not alter the state of the server; read only
safe methods
exhibit idempotency
idempotent methods
property of certain operations such that they can be applied several times without changing the result of the initial application
idempotency
all safe methods are also _____
idempotent
if the method used in the request is cacheable (GET) then the response is considered cacheable (HEAD)
cacheable methods
5 groups of status codes
1xx: informational
2xx: success
3xx: redirection
4xx: client error
5xx: server error
generic success message
200 OK
req was a success and a new resource was created as a result
201 Created
indicate that further action needs to be taken
3xx
url requested refers to multiple resources
300 Multiple Choices
resource has been moved to a different URL
301 Moved Permanently
browsers redirected to the temporary URL but crawlers don’t update their databases
302 Found
resource hasn’t been modified so there’s no need to retransmit the data
304 Not Modified
client sent a request message with invalid syntax
400 Bad Request
request was not acted upon because it lacks valid authentication credentials
401 Unauthorized
server understood the request but will not authorize it
403 Forbidden
no resource found in the specified URL
404 Not Found
method used in the request isn’t supported for the specified resource
405 Method Not Allowed
access to the target resource is no longer available
410 Gone
client sent an entity body larger than the server can or wants to process
413 Request Entity Too Large
client sent a request with a URL longer than the server can or wants to process
414 Request URI too long
content type of the request payload is not supported by the server
415 Unsupported Media Type
common causes of server side errors (3)
server limitations
error in server components
proxy errors
generic server error message
500 Internal Error
server does not support the functionality to fulfill the request
501 Not Implemented
server isn’t ready to handle the request usually due to server overload
503 Service Unavailable
server couldn’t get a response in time from the next entity
504 Gateway Timeout
server doesn’t support the HTTP version used in the request message
505 HTTP Version Not Supported
client should continue with the request or ignore the response if it’s already finished
100 Continue
server is switching to the protocol requested by the client
101 Switching Protocols
allow the client and server to pass additional information
headers
4 types of headers
general
request
response
entity
contain general information that does not apply to the contents of the message body
general headers
may contain info about the resource requested or the client itself; only used in request msgs
request headers
client requests a new copy of the resource if it has been modified since the specified date
if-modified-since
details about the browser, rendering engine, os, architecture
user-agent
cookies set by the server
cookie
used to give more detailed information about the response
response headers
how much time the response has been in a proxy cache
age
indicates the redirection url
location
details about the server’s software
server
describe the content of the message body
entity header
entity headers can contain information about the payload such as (6)
content length
language
encoding
location
type
date of last modification
MIME
multipurpose internet mail extension
help the receiving entity decide what to do with the data
MIME types
MIME Types:
text/css
text/html
application/zip
application/powerpoint
application/pdf
Purpose:
for design/layout
render the doc as HTML
open a download prompt
display as a document
display as a document