How to complete the challenge PUT /api/todos/{id} no body id (200)
Issue a PUT request to /api/todos/{id} and do not include an id field in the request body.
This is a common PUT design: the URL identifies the resource and the body supplies the replacement state.
Basic Instructions
- Send
PUT /api/todos/{id}where{id}is an existing todo id - Add an
X-CHALLENGERheader to track challenge completion - Set
Content-Typetoapplication/json - Do not include an
idfield in the JSON payload - Include a valid
title - Verify the response status is
200
Example body:
{
"title": "updated using URL id",
"doneStatus": false,
"description": "the id is only in the URL"
}
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 an id in the payload
Lessons Learned
PUT /api/todos/{id}can use the path parameter as the update target when the body omitsid.- Omitting body
idavoids one class of mismatch while still requiring a valid representation. - The URL is part of the contract, not just routing decoration.
Suggested Experiments
- Add a matching body
idand compare the response with the no-body-id request. - Change only the path
idwhile keeping the body the same to see which resource is updated.