How to complete the challenge GET /api/todo 404.
How to solve challenge GET todo 404 by issuing a GET request on a non-existent endpoint and receive a 404 status code response.
GET /api/todo (404)
Issue a
GETrequest on the/api/todoend point should 404 because nouns should be plural
- This will show you an error status code 404
- 404 means 'not found' i.e. we tried to access something that does not exist
- REST API Endpoints are usually plural e.g.
/api/todoswe would not normally expect an API to respond to both/api/todosand/api/todo
Basic Instructions
- Issue a GET request to end point "/api/todo"
https://apichallenges.com/api/todo
- The request should have an
X-CHALLENGERheader - The response status code should be
404
Try it now
GET /api/todo to trigger 404 for the singular endpoint
Example Request
> GET /api/todo HTTP/1.1
> Host: apichallenges.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: */*
Example Response
< HTTP/1.1 404 Not Found
< Connection: close
< Date: Thu, 27 Aug 2020 13:46:19 GMT
< X-Challenger: x-challenger-guid
< Server: Jetty(9.4.z-SNAPSHOT)
< Via: 1.1 vegur
Overview Video
Lessons Learned
/api/todois the wrong route, so404 Not Foundhere tests URL design and plural resource naming.- This is not a missing todo
id; the route itself does not match the API contract. - Path typos can look like data problems unless you compare the documented URL.
Suggested Experiments
- Change only
/api/todoto/api/todosand confirm the sameGETstyle reaches a valid collection route. - Try
/api/todos/999999after/api/todoand compare route-not-found with resource-not-found behavior.