![]() Since we need to update the existing booking details then we must need to pass the booking id in URI as a path parameter. The API documentation contains all information like URI, headers, cookies, authorization, payload, status codes, etc. ![]() You must need to go throw with the API documentation. Let’s explore and understand our example APIs. So PATCH can not be used to create new resources. In a PATCH request, we just send data that we want to update. The reason that a PUT request can be used to create a new resource because we need to send a complete payload to the server where the server replaces the existing state of the resource with the latest payload. But note here that a PUT request can be made as non-idempotent as well. PUT is not a safe method as it performs data creation and modifications but it is idempotent as if we hit the same request again, it operates on the same existing resource. If a PUT request is made to create a new resource if the target resource is not available then it should return a status code 201(Created). Update Booking – Update a booking What is a PUT HTTP method or PUT API?Īn HTTP PUT method is used to primarily update the resource information but it also can be used to create a new resource (Depends on API development) if the requested resource is not available. If a PUT request is made to update a resource, it should return 200 (OK) and 204 (No Content) status codes. I will use below PUT API for this post to show the demo:. You should have a preferably native Postman app installed on your system.How to add authorization in Postman for a PUT request?.Step by step process of sending a PUT request in Postman tool.Topics we are going to learn in this post View the response body and other detailsĪs a part of the Postman Tutorial – End to End tutorials series, in this post, we will learn to send a PUT request in Postman for a REST API.Pass the request URI in the address bar of Postman. ![]()
0 Comments
Leave a Reply. |