How to complete the challenge PUT /api/todos/{id} no title (422)
Issue a PUT request to an existing todo and omit the mandatory title field.
The response should be 422 Unprocessable Content because the request body is valid JSON, but the replacement todo fails validation.
Look for the validation message containing:
title : field is mandatory
Try it now
If you don't know what todos are available then you can check by GET /api/todos. See the solution.
GET /api/todos to see what todos are available now
If you have already deleted all todos, create one using POST /api/todos. See the solution.
POST /api/todos to create a todo item for this challenge
PUT /api/todos/{id} without a title to trigger 422
Lessons Learned
titleis mandatory for thisPUTupdate, even when the resourceidis valid.- Required-field validation happens after the API has identified the target resource.
- A missing required field is different from an empty or too-long value.
Suggested Experiments
- Add
titleback without changing any other field and confirm the request becomes valid. - Send
titleas an empty string and compare that error with the missing-title response.