Methods in an API - API Tutorial



There are different Methods used during API Design and development.


Some of the important methods are:

  1. GET method
  2. POST method
  3. PUT method
  4. PATCH method
  5. DELETE method

API Image

1. GET Method

GET method is used to fetch some resources from the server. GET APIs are said to be idempotent, which means, in case of multiple calls, they will return the same result every time, unless and until they have been modified using an another way, either a POST or PUT API call or in case of any backend data update.



2. POST Method

POST method is used to create a new resource in the server. POST APIs are not idempotent. In such APIs, usually additional information is passed to the server in API payload (body) and/or in API headers.



3. PUT Method

PUT method is used when we want to modify an existing resource in the server.



4. PATCH Method

PATCH method is used when we want to selectively modify any attribute of an existing resource in the server. As the name suggest, it used for partial updates in a resource.



5. DELETE Method

DELETE method is used when we want to delete an existing resource from the server. DELETE APIs are idempotent.

If you liked this tutorial, consider sharing among your networks.


Also check out:


Online REST API Testing Tool
API Status Codes

Follow Me on Social Media

Advertisement
FREE Sales CRM Software

Fully customizable CRM Software for Freelancers and Small Businesses

Signup for Free

Sign up for DigitalOcean Cloud

Get FREE $200 credits, deploy your hobby projects for Free

DigitalOcean Referral Badge
Sign up for Hostinger Cloud or VPS plans and get upto 20% Discount