DEV Community

Cover image for The REST API Trick 95% of Developers Miss!
Alok Kumar
Alok Kumar

Posted on

The REST API Trick 95% of Developers Miss!

REST API

REST API is a way that enables communication between systems. It uses the HTTP method to exchange data in JSON format.

There are Different HTTP Methods

  • GET
  • POST
  • DELETE
  • PUT

GET

The GET method is used to retrieve data from a database.

POST

The POST method is used to add & update data to the Database.

DELETE

The Delete method is used for deleting the data from the Database.

PUT

The PUT method is used to replace the existing data provided in the request body.

Best Practices to create Routes

Never use a verb while writing an API
❌GET /getUerDetails incorrect way
✅GET /userdetails in the correct way

Separate them using a Hyphen
❌GET /getuserDetails
✅GET /user-details

In the API path and Route, everything is in lowercase
❌GET /User-Details
✅GET /user-details

Top comments (0)