How to complete the challenge GET /todos (200) ? filter id less than

How to issue a GET request on a top level entity endpoint and filter todos by ids less than a supplied value.

GET /todos (200) ? filter id less than

Issue a GET request on the /todos end point with an id filter to return todos with an id less than a supplied value.

  • id<6 means return todos where the id is less than 6
  • most tools and browsers will encode the < symbol for you when sending the request
  • the response should contain at least one todo
  • the response should be a subset of the current todos, not the full list
  • every returned todo should have an id less than the threshold

Basic Instructions

  • Issue a GET request to end point "/todos"
    • https://apichallenges.com/todos
  • The request should have an X-CHALLENGER header to track challenge completion
  • Add an id less-than filter:
    • https://apichallenges.com/todos?id<6
  • The response status code should be 200 because the request is accepted
  • Check that every returned todo has an id less than 6

Try it now

If you need to check which todo ids are available, use GET /todos. See the solution.

GET /todos to see the available todo ids

The sample below uses id<6; edit the threshold if your current data needs a different subset.

GET /todos?id<6 to return todos with ids less than 6

Example Request

> GET /todos?id<6 HTTP/1.1
> Host: apichallenges.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": 2, "title": "lower id todo", "doneStatus": false, "description": "" }
  ]
}
Experiment with this endpoint