How to complete the challenge GET /todos (406) q rejects all

This challenge sends an Accept header that names supported formats but explicitly rejects both of them.

Issue a GET request on the /todos end point with an Accept header of application/json;q=0, application/xml;q=0 to receive 406 'NOT ACCEPTABLE' status code.

Basic Instructions

  • Issue a GET request to /todos
  • Add the X-CHALLENGER header to track challenge completion
  • Set Accept to application/json;q=0, application/xml;q=0
  • Check that the response status is 406
  • Check that the error response is returned in a format your client can inspect

Try it now

GET /todos while rejecting JSON and XML

Example Request

> GET /todos HTTP/1.1
> Host: apichallenges.com
> X-CHALLENGER: x-challenger-guid
> Accept: application/json;q=0, application/xml;q=0

Example Response

< HTTP/1.1 406 Not Acceptable
< Content-Type: application/json
< X-Challenger: x-challenger-guid

The error body should explain that no acceptable response type was available.

Lessons Learned

  • q=0 excludes a media type, even when the API normally supports that representation.
  • Listing only excluded JSON and XML choices leaves no normal todo representation to return.
  • A 406 response can be the correct result when the client rules out every supported format.

Suggested Experiments

  • Change application/json;q=0 to application/json;q=0.1 and confirm that the request can succeed.
  • Add */*;q=0.1 and observe whether the server can choose a default fallback.
  • Compare this with an unsupported type such as application/gzip, where no supported media type is named.
Experiment with this endpoint