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 /todos end point with an Accept header of application/*+xml to receive results in a supported structured XML format.

Basic Instructions

  • Issue a GET request to /todos
  • Add the X-CHALLENGER header to track challenge completion
  • Set Accept to application/*+xml
  • Check that the response status is 200
  • Check that the response Content-Type is a supported structured todo XML media 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/*+xml can match a supported structured XML media type such as application/todo+xml.
  • A suffix wildcard is narrower than */* because it still requires an application media 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/*+xml with Accept: application/xml and note the selected response media type.
  • Try Accept: application/*+json and confirm that structured JSON negotiation is independent from plain application/json.
  • Send Accept: application/*+xml;q=0, application/json;q=1 and verify that the wildcard is excluded.
Experiment with this endpoint