HTTP
methods
you must
know
Get
Example
GET/ api/customers
Return all customers
Description
Retrieves data from server. it should
retrieve data and should have no
other side effect.
POST
Example
POST/ api/customers
Post data to the server
Description
Used to send data to a server to
create a new resource. The data is
included in the body of the request
PUT
Example
PUT/ api/customers/123
Update customer by ID
Description
Similar to POST, but it’s used to
update an existing resource
PATCH
Example
PATCH/ api/customers/1234
{’name’: “cherry”}
Update name for customer
by ID 1234
Description
Used to update resources but it only
updates the fields that were
included in the request
DELETE
Example
DELETE/ api/customers/143
Delete customer by ID
Description
Deletes a resource.
Regardless of number of calls, it
returns the same result.
HEAD
Example
HEAD/ api/customers
Similar to GET, but does not
return the list of customers
Description
Typically used to check if a resource
is available and to get the metadata.
OPTIONS
Example
OPTIONS/ api/main.html/1.1
Return Permitted HTTP
method in this URL
Description
Used to get information about the
possible communication options for
the given URL or an asterisk to refer
to the entire server.
TRACE
Example
TRACE/ api/main.html
Responds the exact request
that client sent
Description
Used for diagnosis purposes. It
echoes the received request so that
a client can see what changes or
additions have been made by
intermediate servers
CONNECT
Example
Connect www.example.com:8080
Connect to the URL Provided
Description
Used for making end to end
connections between a client and a
server, it makes a two way
connection like a tunnel between
them.