POST methods
The POST method is used to create new resources. For instance, if the manager of our book store wanted to add a new product to the database, they would send a POST request to the /products endpoint. Unlike GET requests, POST requests typically include a request body, which is where the client specifies the attributes of the resource to be created. ~ Postman adapted.
JSON Payload for Books - Practical Example
The client sends a JSON payload with the parameters, which the server processes to make a specific action (like adding/editing a book document).
post.py
data = request.get_json()Body (form-data) for Users - Practical Example
The client sends a Body (form-data) with the values and keys, which the server processes to make a specific action.
post.py
username = request.form.get("username")
password = request.form.get("password")