You can support this site from as little as $1 a month on Patreon.

The support pays for site hosting and the expansion of this content.

In addition, Patreon Supporters gain access to exclusive online video training courses and ebooks.

Join Now

How to complete the challenge GET /todos XML (200)

When we issue a GET request we can use the Accept header to request a specific format of result from the API. In this case we will ask for XML to successfully GET all the todos in XML format.

GET /todos XML (200)

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

  • GET request will receive a response with all the todo items
    • e.g. GET /todos to get all the todo items
  • 200 is a success code, in this case it means the end point exists and the `todo items were returned
  • Accept means that an Accept header was added to specify that the todos should be returned in XML format
  • add the X-CHALLENGER header to track progress

Basic Instructions

  • Issue a GET request to end point "/todos"
    • if running locally that endpoint would be
      • https://apichallenges.eviltester.com/todos
  • The request should have an Accept header specifying XML format by using a value of application/xml
  • The request should have an X-CHALLENGER header to track challenge completion
  • The response status code should be 200 when all the details are valid.
  • Check the body of the message has XML format data
  • Check the content-type header in the response has application/xml

Example Request

> GET /todos HTTP/1.1
> Host: apichallenges.eviltester.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: application/xml

Example Response

< HTTP/1.1 200 OK
< Connection: close
< Date: Thu, 22 Apr 2021 16:49:31 GMT
< Content-Type: application/xml
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: *
< X-Challenger: x-challenger-guid
< Server: Jetty(9.4.z-SNAPSHOT)
< Via: 1.1 vegur

Example Response body:

<todos>
  <todo>
    <doneStatus>false</doneStatus>
    <description/>
    <id>273</id>
    <title>scan paperwork</title>
  </todo>
  <todo>
    <doneStatus>false</doneStatus>
    <description/>
    <id>277</id>
    <title>pay invoices</title>
  </todo>
</todos>

Overview Video

Watch on YouTube: "Solution to Get all Todos in XML format"

Patreon ad free version