xxxxxxxxxx
GET
getting data in the server
POST
adding data to the server
we need to provide the data in the format
the document specify
and tell exactly what type if data we are sending
defined by Content-Type Header
Common status code for successful POST is
201 Created -- you will have response body
PUT
Put is used to update the exsisting data from the server
difference between PUT and POST
POST is adding new data
so the URL will be /api/spartans
PUT is updating existing data
so the URL will be /api/spartan/validIDNumberHere
provide updated data
provide the contenttype of the data you are sending to update
common status code for successful PUT request
is 204 NO-CONTENT , it has no response body
204 means it was updated successfully
DELETE
Delete method is used to delete the data from the server
Request URL will /api/spartan/theValidID
common status code for successful Delete request
is 204 NO-CONTENT , it has no response body
204 means it was deleted successfully
xxxxxxxxxx
Get : enables you to retrieve data from server
Post: enables you to add data to an existing
file or resource in a server
Put: lets you replace an existing file or resource
in a server
Delete: lets you delete data from server
Patch:For partial update
xxxxxxxxxx
1. GET
2. POST
3. PUT
4. DELETE
>> POST == CREATE, GET == READ, PUT == UPDATE, DELETE == DELETE <<
xxxxxxxxxx
GET - Used to fetch data from server. Usually record(s) from database.
POST - Sends data to the server. Usually to insert record into a database.
PUT - Update data on the server. Usually to do full update (all fields) of a record in the database.
PATCH - Update data on the server. Usually to do specific field update of a record in the database.
DELETE - Sends request to delete an existing record on the database.
xxxxxxxxxx
The OPTIONS Method lists down all the
operations of a web service supports.
It creates read-only requests to the server.