How to complete the challenge POST /todos JSON to XML
The content-type and accept headers do not need to be the same.
API Challenges allows us to send a POST request to create a todo item using JSON but receive an XML response.
POST /todos XML to JSON
Issue a POST request on the
/todosend point to create a todo using Content-Typeapplication/jsonbut Acceptapplication/xml
- POSTrequest means we will send information in the body of the message- e.g. POST /todossends to the todos endpoint
 
- e.g. 
- create a todomeans that the payload will be valid data to create a todo item
- using Content-Type- application/jsonmeans that we will set- content-typeheader to- application/jsonand the payload will be in JSON format
- Accept- application/xmlmeans add an- acceptheader of- application/xmlto receive the response in JSON format
- add the X-CHALLENGERheader to track progress
Basic Instructions
We can mix different accept and content-types so we can send payloads in one format, and receive responses in another format. This challenge is about sending payload in JSON but having the response in XML.
- Issue a POSTrequest to end point "/todos"- if running locally that endpoint would be
- https://apichallenges.eviltester.com/todos
 
 
- if running locally that endpoint would be
- The request should have an Content-Typeheader ofapplication/json
- add a valid payload in JSON format to create a todo item e.g.
   {
        "title": "create todo process payroll",
        "doneStatus": true,
        "description": ""
   }
- add an acceptheader ofapplication/xmlto receive the response in XML format
- The request should have an X-CHALLENGERheader to track challenge completion
- The response status code should be 201when all the details are valid.
- Check the body of the response has XML formatted todo item with full details of the created item
- Check the location header for the REST API call to retrieve details of the created item
Extras:
- try GET the location header URL to return the created todo item
Example Request
> POST /todos HTTP/1.1
> Host: apichallenges.eviltester.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Content-Type: application/json
> accept: application/xml
> Content-Length: 106
|    {
|       "title": "create todo process payroll",
|       "doneStatus": true,
|       "description": ""
|     }
Example Response
< HTTP/1.1 201 Created
< Connection: close
< Date: Sun, 18 Jul 2021 09:03:58 GMT
< Content-Type: application/xml
< Location: todos/320
< 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:
<todo>
   <doneStatus>true</doneStatus>
   <description/>
   <id>320</id>
   <title>create todo process payroll</title>
</todo>