Delete a todo item in the application
How to complete the challenge DELETE /todos/id (204) to successfully delete a todo item in the application.
DELETE /todos/id (204)
Issue a DELETE request to successfully delete a todo
DELETErequest will delete a todo if the providedidexists/todos/idend point- e.g.
DELETE /todos/3to delete the todo withid==3
- e.g.
204is a success code, in this case it means the todo was deleted and there is no response body- add the
X-CHALLENGERheader
Basic Instructions
- Issue a
DELETErequest to end point "/todos/id"- where
idis replaced with the id of an existing todo- if you don't know any then a
GET /todoswould show a list of todos, or you couldPOST /todosto create one.
- if you don't know any then a
- e.g using endpoint
https://apichallenges.com/todos/id
- where
- The request should have an
X-CHALLENGERheader to track challenge completion - The response status code should be
204when all the details are valid and the todo exists. - To double check that the todo item was deleted, then you could issue a
GETrequest on the todo directly and receive a404or issue aGETrequest on/todosand check it is not in the list of todos.
Try it now
Delete an existing todo.
If you don't know what todos are available then you can check by GET /todos. See the solution.
GET /todos to see what todos are available now
If you have already deleted all todos, create one using POST /todos. See the solution.
POST /todos to create a todo item for deletion
Then, delete an existing todo:
DELETE /todos/{id} to delete a specific todo
After you've deleted something. You should really check that it has been deleted by issuing a GET /todos/{id} request and make sure the item has been deleted.
Example Request
> DELETE /todos/62 HTTP/1.1
> Host: apichallenges.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: */*
Example Response
< HTTP/1.1 204 No Content
< Connection: close
< Date: Thu, 27 Aug 2020 14:25:53 GMT
< X-Challenger: x-challenger-guid
< Server: Jetty(9.4.z-SNAPSHOT)
< Via: 1.1 vegur