How to complete the challenge GET /todos/export (200) CSV download
This challenge uses an export endpoint instead of the normal GET /todos endpoint. The response body is CSV and the response headers tell the client to treat the response as a downloadable file.
GET /todos/export CSV download
Issue a GET request on the
/todos/export?format=csvend point and receive a CSV response with aContent-Dispositionheader fortodos.csv.
GETasks the API to return the todos./todos/exportuses aformatquery parameter to choose the representation.format=csvrequests comma-separated values.Content-Disposition: attachmenttells the client this can be treated as a file download.filename="todos.csv"suggests the download filename.- Add the
X-CHALLENGERheader to track progress.
Basic Instructions
- Issue a
GETrequest to end point "/todos/export?format=csv"- if running locally that endpoint would be
https://apichallenges.eviltester.com/todos/export?format=csv
- 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/csv. - Check the
Content-Dispositionresponse header isattachment; filename="todos.csv". - Check the response body contains CSV data.
The format query parameter controls the export type for this endpoint, so this challenge does not depend on the request Accept header.
Try it now
Example Request
> GET /todos/export?format=csv HTTP/1.1
> Host: apichallenges.eviltester.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: text/csv
Example Response
< HTTP/1.1 200 OK
< Content-Type: text/csv
< Content-Disposition: attachment; filename="todos.csv"
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: *
< X-Challenger: x-challenger-guid
Example Response body:
id,title,doneStatus,description
1,scan paperwork,false,
2,file paperwork,true,
Extra Experiment
Open todos.csv in your browser to request the CSV export directly.
Other format parameter values to try include json, xml, text, html, 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.
Try changing the request Accept header to application/json while keeping format=csv. The export endpoint should still return CSV because the format is selected by the query parameter.