Skip to main content

May 9, 2021 - 2 minute read - API Testing API Challenges Evil Tester

Challenge 15 - How To - GET todos JSON - 200

This post and video shows how to complete the challenge GET /todos JSON (200) to successfully GET all the todos in JSON format.

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 JSON (200)

Issue a GET request on the /todos end point with an Accept header of application/json to receive results in JSON format

  • GET request will receive a response with all the todo items
    • e.g. GET /todos to get all the todo items
  • 200 is a success code, in this case it means the end point exists and the `todo items were returned
  • Accept means that an Accept header was added to specify that the todos should be returned in JSON format
  • add the X-CHALLENGER header to track progress

Basic Instructions

  • Issue a GET request to end point “/todos”
    • if running locally that endpoint would be
      • http://localhost:4567/todos
    • if running in the cloud that endpoint would be
      • https://apichallenges.herokuapp.com/todos
  • The request should have an Accept header specifying JSON format by using a value of application/json
  • The request should have an X-CHALLENGER header to track challenge completion
  • The response status code should be 200 when all the details are valid.
  • Check the body of the message has JSON format data
  • Check the content-type header in the response has application/json

Insomnia Details

> GET /todos HTTP/1.1
> Host: apichallenges.herokuapp.com
> User-Agent: insomnia/2021.2.2
> X-CHALLENGER: x-challenger-guid
> Accept: application/json
< HTTP/1.1 200 OK
< Connection: close
< Date: Sun, 09 May 2021 11:07:48 GMT
< Content-Type: application/json
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: *
< X-Challenger: x-challenger-guid
< Server: Jetty(9.4.z-SNAPSHOT)
< Via: 1.1 vegur

Example Response body:

{
    "todos": [
        {
            "id": 16,
            "title": "process payroll",
            "doneStatus": false,
            "description": ""
        },
        {
            "id": 15,
            "title": "pay invoices",
            "doneStatus": false,
            "description": ""
        }
    ]
}

Overview Video

Watch on YouTube

Patreon ad free version

Learn More and Start Testing


You will need a Github account to comment. Or you can contact me with your comment.

I reserve the right to delete spam comments e.g. if your comment adds no value and its purpose is simply to create a backlink to another site offering training, or courses, etc.