This post and video shows how to complete the challenge GET /todos/id 404
using Insomnia.
What are the API Challenges?
Our API Challenges Application has a fully functional cloud hosted API, and a set of challenges to work through.
GET /todos/id (404)
Issue a GET request on the
/todos/{id}
end point for a todo that does not exist
- This will show you a 404 status code in the API response
- 404 status code means Not Found
- The
{id}
means, replace this with the id of a non-existant todo item
Basic Instructions
- Issue a GET request to end point “/todos/{id}”
- if running locally that would be
http://localhost:4567/todos/{id}
- if running in the cloud that would be
https://apichallenges.herokuapp.com/todos/{id}
- if running locally that would be
- The request should have an
X-CHALLENGER
header - The response status code should be
404
because{id}
does not exist - an error message should be shown in the response body
Insomnia Details
> GET /todos/20 HTTP/1.1
> Host: apichallenges.herokuapp.com
> User-Agent: insomnia/2020.3.3
> X-CHALLENGER: x-challenger-guid
> Accept: */*
< HTTP/1.1 404 Not Found
< Connection: close
< Date: Thu, 27 Aug 2020 13:53:54 GMT
< Content-Type: application/json
< X-Challenger: x-challenger-guid
< Server: Jetty(9.4.z-SNAPSHOT)
< Via: 1.1 vegur
Example Response
{
"errorMessages": [
"Could not find an instance with todos/20"
]
}