Let’s list down when to use POST and when to use PUT :
GET /user-management/users: Get all users
POST /user-management/users: Create a new user
GET /user-management/users/{id} : Get the user information identified by "id"
PUT /user-management/users/{id} : Update the user information identified by "id"
It is good practice to use:
- PUT for UPDATE operations.
- POST for CREATE operations.
- PUT is Idempotent
- POST is not Idempotent.
*************************************************
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
Will PUT also create the resource if it not found on server?
ReplyDeleteYes PUT is designed that way.
ReplyDelete