How to complete the challenge GET /api/todos/{id} (200) text/calendar

This challenge asks for one existing todo in calendar format. The API returns a minimal VCALENDAR containing a single VTODO.

GET /api/todos/{id} (200) text/calendar

Issue a GET request on the /api/todos/{id} end point with an Accept header of text/calendar to receive the todo as a VTODO.

  • Use a real todo id, not the literal text {id}
  • Add the Accept: text/calendar header
  • Add the X-CHALLENGER header to track progress
  • The response status should be 200
  • The response Content-Type should be text/calendar

Basic Instructions

  • Find an existing todo by calling GET /api/todos
  • If there are no todos, create one with POST /api/todos
  • Issue a GET request to /api/todos/{id}
  • Send Accept: text/calendar

Try it now

If you don't know what todos are available, list them first.

GET /api/todos to see what todos are available now

If there are no todos, create one.

POST /api/todos to create a todo for the calendar request
GET /api/todos/{id} as text/calendar

Example Request

> GET /api/todos/1 HTTP/1.1
> Host: apichallenges.com
> X-CHALLENGER: x-challenger-guid
> Accept: text/calendar

Example Response

< HTTP/1.1 200 OK
< Content-Type: text/calendar
< X-Challenger: x-challenger-guid

Example Response body:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//EvilTester//API Challenges//EN
BEGIN:VTODO
UID:todo-1@apichallenges
SUMMARY:calendar todo
DESCRIPTION:created for the text/calendar solution
STATUS:NEEDS-ACTION
END:VTODO
END:VCALENDAR

Lessons Learned

  • text/calendar demonstrates that a single todo can be represented as a VTODO, not only as JSON or XML.
  • Collection and single-resource endpoints may support different media types.
  • Content negotiation should verify both Content-Type and domain-specific body structure.

Suggested Experiments

  • Request GET /api/todos/{id} with Accept: text/calendar and then with Accept: application/json to compare fields.
  • Try Accept: text/calendar on /api/todos and observe whether the collection supports the calendar representation.
Experiment with this endpoint