Set Status Codes on JSON Replies
Pair JSON bodies with 201, 404, and friends.
Status Codes Tell the Story
Every HTTP response carries a status code that signals success or failure. Your JSON body explains the details, but the code sets the tone first. 🚦
The Default Is 200
When you return jsonify alone, Flask sends 200 OK. That is perfect for a successful read, but other actions deserve their own code.
All lessons in this course
- jsonify a Dictionary
- Return Lists and Nested Data
- Set Status Codes on JSON Replies
- Content-Type and the Accept Header