Implement the PUT Endpoint for Updating an Existing Product
Learn how to implement products API using Flask to update an existing product.
REST API uses PUT to update an existing resource in a collection. We’ll see how to implement an API endpoint that uses PUT to update an existing product in the collection.
The request
object of Flask can be used to retrieve the body of a PUT request, and path parameter mapping can be used to get the ID of the product to be updated. The Route
decorator can be used to map a method to the PUT request. Let’s see how to do the same.
Steps
-
Open
server/api/products_api.py
. -
Add a new method. Name the method ...
Access this course and 1400+ top-rated courses and projects.