Renovated when used with HTTP depends on resources (URLs) and relies on the actions of HTTP verbs, this is common, and good practice has used these verbs to define some operations on resources that you have:
- GET retrieves all or just one resource.
- Normally POST creates a new resource.
- PUT used to update a resource
DELETE delete a resource
One of the first tasks that we must complete before launching our Restful API is to determine what resources we need and what their attributes will be. The first rule over this approach is to use nouns rather than verbs such as a person, ticket, client, etc.
After defining your resources, you need to determine what actions are applicable to them and how they will be displayed in your API. RESTful principles provide strategies for handling CRUD actions using HTTP methods, displayed as follows.
GET / tickets - Get a list of tickets
GET / tickets / 12 - Get a specific ticket
POST / tickets - Creates a new ticket
PUT / tickets / 12 - Update ticket No. 12
PATCH / tickets / 12 - Partially updates ticket number 12 <- checks this approach.
DELETE / tickets / 12 - Deletes ticket # 12
The above depends on the firewall configurations, but consider the above as a suggestion for API design principles.
source share