POST Challenger 201 Solution

How to complete the challenge POST /api/challenger 201.

POST /api/challenger (201)

Issue a POST request on the /api/challenger end point, with no body, to create a new challenger session. Use the generated X-CHALLENGER header in future requests to track challenge completion.

  • This challenge is essential if you want to persist your sessions in multi-user mode
  • This challenge is optional if you want to work in single-user mode

Basic Instructions

  • Issue a POST request to end point "/api/challenger"
    • https://apichallenges.com/api/challenger
  • The response will have an X-CHALLENGER header
  • Use this in any future requests to track your progress
  • The LOCATION header has a url to access your challenge status through the GUI

Try it now

POST /api/challenger to create a new challenger session

Example Request

POST /api/challenger HTTP/1.1
Host: localhost:4567
User-Agent: rest-client
Accept: */*
Content-Length: 0

Example Response

HTTP/1.1 201 Created
Date: Tue, 28 Jul 2020 14:26:48 GMT
X-CHALLENGER: 5afe0000-5eed-4000-8000-000000defa17
Location: /api/challenger/5afe0000-5eed-4000-8000-000000defa17
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Server: Jetty(9.4.z-SNAPSHOT)

Overview Video

Watch on YouTube: "Solution to create challenge session"

Patreon ad free version

Lessons Learned

  • POST /api/challenger creates a new session resource and returns its identifier in X-CHALLENGER.
  • Session creation is the setup step that makes later challenge completion trackable.
  • The session id is both response data and a required request header for future work.

Suggested Experiments

  • Create two challenger sessions and compare how their X-CHALLENGER values isolate progress.
  • Use a newly returned X-CHALLENGER on GET /api/challenges and confirm completion starts from a fresh state.
Experiment with this endpoint