How to complete the challenge GET /todos/export (200) tab-delimited download

This challenge exports todos as tab-delimited data. Tab-delimited content is often called TSV, which means tab-separated values. The endpoint accepts both format=tsv and format=tab-delimited.

GET /todos/export tab-delimited download

Issue a GET request on the /todos/export?format=tsv end point and receive a tab-delimited response with a Content-Disposition header for todos.tsv.

  • GET asks the API to return the todos.
  • /todos/export uses a format query parameter to choose the representation.
  • format=tsv requests tab-separated values.
  • format=tab-delimited is an alias for the same export.
  • Content-Disposition: attachment tells the client this can be treated as a file download.
  • filename="todos.tsv" suggests the download filename.
  • Add the X-CHALLENGER header to track progress.

Basic Instructions

  • Issue a GET request to end point "/todos/export?format=tsv"
    • if running locally that endpoint would be
      • https://apichallenges.com/todos/export?format=tsv
  • The request should have an X-CHALLENGER header to track challenge completion.
  • The response status code should be 200.
  • Check the Content-Type response header starts with text/tab-separated-values.
  • Check the Content-Disposition response header is attachment; filename="todos.tsv".
  • Check the response body contains tab-delimited data.

The format query parameter controls the export type for this endpoint. For this challenge, format=tsv and format=tab-delimited should both produce the same response type and filename.

Try it now

GET /todos/export?format=tsv to download todos as TSV

Example Request

> GET /todos/export?format=tsv HTTP/1.1
> Host: apichallenges.com
> User-Agent: rest-client
> X-CHALLENGER: x-challenger-guid
> Accept: text/tab-separated-values

Example Response

< HTTP/1.1 200 OK
< Content-Type: text/tab-separated-values
< Content-Disposition: attachment; filename="todos.tsv"
< 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.tsv in your browser to request the tab-delimited export directly.

Other format parameter values to try include json, xml, csv, text, html, ndjson, jsonl, json-seq, and tab-delimited. The text aliases txt and plain, JSON sequence alias jsonseq, and tab aliases tab, tabs, and tab-separated are also supported.

Repeat the request with /todos/export?format=tab-delimited. It should still return Content-Type: text/tab-separated-values and Content-Disposition: attachment; filename="todos.tsv".

Experiment with this endpoint