How to complete the challenge GET /todos (200) structured XML wildcard
This challenge uses a structured suffix wildcard: any supported application media type ending in +xml.
Issue a GET request on the
/todosend point with anAcceptheader ofapplication/*+xmlto receive results in a supported structured XML format.
Basic Instructions
- Issue a
GETrequest to/todos - Add the
X-CHALLENGERheader to track challenge completion - Set
Accepttoapplication/*+xml - Check that the response status is
200 - Check that the response
Content-Typeis a supported structured todoXMLmedia type
Try it now
GET /todos with a structured XML wildcard
Example Request
> GET /todos HTTP/1.1
> Host: apichallenges.com
> X-CHALLENGER: x-challenger-guid
> Accept: application/*+xml
Example Response
< HTTP/1.1 200 OK
< Content-Type: application/todo+xml
< X-Challenger: x-challenger-guid
The response body should contain the todo collection as XML.
Lessons Learned
application/*+xmlcan match a supported structuredXMLmedia type such asapplication/todo+xml.- A suffix wildcard is narrower than
*/*because it still requires anapplicationmedia type ending in+xml. - The server chooses the concrete response media type, so tests should read the returned
Content-Type.
Suggested Experiments
- Compare
Accept: application/*+xmlwithAccept: application/xmland note the selected response media type. - Try
Accept: application/*+jsonand confirm that structuredJSONnegotiation is independent from plainapplication/json. - Send
Accept: application/*+xml;q=0, application/json;q=1and verify that the wildcard is excluded.