How to complete the challenge GET /todos/export (200) HTML download
This challenge asks for an HTML export of the todos. The important part is not only the HTML body; the response should also include a Content-Disposition header that marks it as a downloadable attachment.
GET /todos/export HTML download
Issue a GET request on the
/todos/export?format=htmlend point and receive an HTML response with aContent-Dispositionheader fortodos.html.
GETasks the API to return the todos./todos/exportuses aformatquery parameter to choose the representation.format=htmlrequests an HTML representation.Content-Disposition: attachmenttells the client this can be treated as a file download.filename="todos.html"suggests the download filename.- Add the
X-CHALLENGERheader to track progress.
Basic Instructions
- Issue a
GETrequest to end point "/todos/export?format=html"- if running locally that endpoint would be
https://apichallenges.eviltester.com/todos/export?format=html
- if running locally that endpoint would be
- The request should have an
X-CHALLENGERheader to track challenge completion. - The response status code should be
200. - Check the
Content-Typeresponse header starts withtext/html. - Check the
Content-Dispositionresponse header isattachment; filename="todos.html". - Check the response body contains an HTML table.
The format query parameter controls the export type for this endpoint. You can send an Accept header, but this challenge is solved by requesting format=html and checking the response headers.
Try it now
Example Request
> GET /todos/export?format=html HTTP/1.1
> Host: apichallenges.eviltester.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: text/html
Example Response
< HTTP/1.1 200 OK
< Content-Type: text/html
< Content-Disposition: attachment; filename="todos.html"
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: *
< X-Challenger: x-challenger-guid
Example Response body:
<table>
<tr><th>id</th><th>title</th><th>doneStatus</th><th>description</th></tr>
<tr><td>1</td><td>scan paperwork</td><td>false</td><td></td></tr>
</table>
Extra Experiment
Open todos.html in a browser or save the response body as todos.html. The same response can be inspected as data or treated as a downloadable HTML file because of the response headers.
Other format parameter values to try include json, xml, csv, text, ndjson, jsonl, json-seq, tsv, and tab-delimited. The text aliases txt and plain, JSON sequence alias jsonseq, and tab aliases tab, tabs, and tab-separated are also supported.