Choosing status codes
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
pick the status code that tells the client exactly what happened.
Planned topics
2xxsuccess:200OK,201Created,204No Content.4xxclient mistake:400bad input,401not authenticated,403not allowed,404not found,409conflict,422valid shape but invalid meaning.5xxserver fault:500,503.- Creation returns
201, not200. A successful delete with no body returns204. - The status code is part of the contract; clients branch on it.
Draft outline details
Demonstration
| Situation | Code |
|---|---|
| Product created | 201 |
| Product not found | 404 |
| Duplicate SKU | 409 |
| Missing required field | 400 |
Check your understanding
Which code for "you are logged in but may not do this"?
Show answer
403.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.