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
/todosend point with anAcceptheader oftext/xmlto receive results in XML format.
Basic Instructions
- Issue a
GETrequest to/todos - Add the
X-CHALLENGERheader to track challenge completion - Set
Accepttotext/xml - Check that the response status is
200 - Check that the response
Content-Typeistext/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/xmlcan be negotiated separately fromapplication/xml.- Client tests should assert the exact response
Content-Typewhen the media type is part of the requirement. - Multiple media types can render the same resource structure as
XML.
Suggested Experiments
- Compare
Accept: text/xmlwithAccept: application/xmland inspect whether only the response media type changes. - Try
Accept: text/xml;q=0.4, application/json;q=1and confirm thatJSONbecomes preferred. - Send
Content-Type: text/xmlon a create request and compare request parsing withapplication/xml.