You can support this site from as little as $1 a month on Patreon.

The support pays for site hosting and the expansion of this content.

In addition, Patreon Supporters gain access to exclusive online video training courses and ebooks.

Join Now

How to complete the challenge GET /todos (200) ?_limit&_offset

How to issue a GET request on a top level entity endpoint and use pagination to skip records before returning a limited page.

GET /todos (200) ?_limit&_offset

Issue a GET request on the /todos end point with pagination limit and offset parameters.

  • _limit controls the maximum number of todos returned
  • _offset controls how many todos are skipped before returning results
  • if _offset is not supplied, the default offset is 0
  • this challenge is passed by requesting up to 5 todos after skipping 5 todos
  • if your current session has fewer todos after the offset, the response will contain fewer todos

Basic Instructions

  • Issue a GET request to end point "/todos"
    • https://apichallenges.eviltester.com/todos
  • The request should have an X-CHALLENGER header to track challenge completion
  • Add _limit=5 and _offset=5 as URL parameters:
    • https://apichallenges.eviltester.com/todos?_limit=5&_offset=5
  • The response status code should be 200 because the request is accepted
  • Check that the response body contains no more than 5 todos

Try it now

Example Request

> GET /todos?_limit=5&_offset=5 HTTP/1.1
> Host: apichallenges.eviltester.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: application/json

Example Response

< HTTP/1.1 200 OK
< Connection: close
< Content-Type: application/json
< X-Challenger: x-challenger-guid

Returned body:

{
  "todos": [
    { "id": 6, "title": "archive notes", "doneStatus": false, "description": "" },
    { "id": 7, "title": "send report", "doneStatus": false, "description": "" },
    { "id": 8, "title": "book meeting", "doneStatus": false, "description": "" },
    { "id": 9, "title": "check stock", "doneStatus": false, "description": "" },
    { "id": 10, "title": "close ticket", "doneStatus": false, "description": "" }
  ]
}