How to complete the challenge GET /todos (200) text/xml

This challenge requests the todo collection using text/xml, an older generic XML media type.

Issue a GET request on the /todos end point with an Accept header of text/xml to receive results in XML format.

Basic Instructions

  • Issue a GET request to /todos
  • Add the X-CHALLENGER header to track challenge completion
  • Set Accept to text/xml
  • Check that the response status is 200
  • Check that the response Content-Type is text/xml

Try it now

GET /todos with Accept text/xml

Example Request

> GET /todos HTTP/1.1
> Host: apichallenges.com
> X-CHALLENGER: x-challenger-guid
> Accept: text/xml

Example Response

< HTTP/1.1 200 OK
< Content-Type: text/xml
< X-Challenger: x-challenger-guid

The response body should contain the todo collection as XML.

Lessons Learned

  • text/xml can be negotiated separately from application/xml.
  • Client tests should assert the exact response Content-Type when the media type is part of the requirement.
  • Multiple media types can render the same resource structure as XML.

Suggested Experiments

  • Compare Accept: text/xml with Accept: application/xml and inspect whether only the response media type changes.
  • Try Accept: text/xml;q=0.4, application/json;q=1 and confirm that JSON becomes preferred.
  • Send Content-Type: text/xml on a create request and compare request parsing with application/xml.
Experiment with this endpoint