Best practices for Better restful API
1. Use nouns but no verbs
For an easy understanding use this structure for every resource:
Resource | GET read | POST create | PUT update | DELETE |
---|---|---|---|---|
/cars | Returns a list of cars | Create a new car | Bulk update of cars | Delete all cars |
/cars/711 | Returns a specific car | Method not allowed (405) | Updates a specific car | Deletes a specific car |
Do not use verbs:
/getAllCars
/createNewCar
/deleteAllRedCars