Friday, 12 April 2019

What is the difference between PUT and POST method? REST API interview questions? Most asked RestAPI Automation Interview questions?



PUT vs POST : An Example

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 

2 comments:

  1. Will PUT also create the resource if it not found on server?

    ReplyDelete
  2. Yes PUT is designed that way.

    ReplyDelete

All Time Popular Posts

Most Featured Post

TestNG Mock Interview Q&A 2025 for QA-SDET

👉𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗤&𝗔 𝗣𝗮𝗰𝗸𝗮𝗴𝗲 𝗳𝗼𝗿 𝗧𝗲𝘀𝘁 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗼𝗻 & 𝗦𝗗𝗘𝗧: https://topmate.io/sidharth_shukla/605319...