How to complete the challenge GET /api/todos (400) ?_limit too high
How to issue a GET request on a top level entity endpoint with a pagination limit above the allowed maximum.
GET /api/todos (400) ?_limit too high
Issue a GET request on the
/api/todosend point with a pagination limit above the configured maximum to receive a 400 status code.
- the maximum supported
_limitvalue is20 _limit=21is too high for this API- this challenge is passed by receiving a
400response for the invalid pagination request
Basic Instructions
- Issue a
GETrequest to end point "/api/todos"https://apichallenges.com/api/todos
- The request should have an
X-CHALLENGERheader to track challenge completion - Add
_limit=21as a URL parameter:https://apichallenges.com/api/todos?_limit=21
- The response status code should be
400because the pagination limit is too high
Try it now
GET /api/todos?_limit=21 to trigger validation for a high limit
Example Request
> GET /api/todos?_limit=21 HTTP/1.1
> Host: apichallenges.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: application/json
Example Response
< HTTP/1.1 400 Bad Request
< Connection: close
< Content-Type: application/json
< X-Challenger: x-challenger-guid
The response body contains validation details explaining that the requested pagination limit is too high.
Lessons Learned
_limithas an upper bound, so pagination parameters need validation like request bodies do.400 Bad Requestis appropriate when the query parameter itself is invalid.- Boundary tests should check just below, at, and above the documented maximum.
Suggested Experiments
- Compare
_limit=20with_limit=21to identify the first failing value. - Send a non-numeric
_limitand compare its error body with the too-high limit response.