Skip to content

Make your first request

In this quickstart, you start a local mock of the KRKplaysTennis API, list players, and read one player’s rating. It takes less than 5 minutes.

KRKplaysTennis is fictional, so there’s no live server. The mock is Prism: it reads the OpenAPI spec of the API and answers each request with the examples in it.

  • Node.js 22 or later. You need it to run the mock, and for the JavaScript examples.
  • A macOS or Linux terminal. On Windows, use WSL.
  • For the Python examples, Python 3.10 or later with the requests package (pip install requests).
  1. Start the mock:

    Terminal window
    npx @stoplight/prism-cli@5 mock https://saverio-cirillo.com/krk-plays-tennis-api/openapi.yaml

    The first run downloads Prism, which takes a few seconds. When the mock is ready, the last line of the output is:

    Prism is listening on http://127.0.0.1:4010

    Keep this terminal open.

  2. In a new terminal, set the base URL and an API key:

    Terminal window
    export KRK_API_URL=http://127.0.0.1:4010
    export KRK_API_KEY=quickstart-key

    The mock accepts any API key, as long as you send one. Every example in these docs reads these two variables, so the same code works with the mock and with a real key.

    To check the variables, run echo $KRK_API_URL. The output is http://127.0.0.1:4010.

  3. List the players:

    Terminal window
    curl --silent "$KRK_API_URL/players" \
    --header "X-API-Key: $KRK_API_KEY"

    The response lists three players: Kasia W., Marta Z., and Ola K. Each player has a rating with a value and a confidence. next_cursor is null, because there are no more pages. The start of the response looks like this:

    {
    "data": [
    {
    "id": "plr_9fz3tr6wn1",
    "display_name": "Kasia W.",
    "self_assessed_ntrp": 4,
    "rating": { "value": 1499, "confidence": 70 },
  4. Get the rating of Ola K., whose player ID is plr_2b7xq9mhk4:

    Terminal window
    curl --silent "$KRK_API_URL/players/plr_2b7xq9mhk4/rating" \
    --header "X-API-Key: $KRK_API_KEY"

    The response shows Ola’s rating after one rated match:

    {
    "player_id": "plr_2b7xq9mhk4",
    "value": 1432,
    "confidence": 30,
    "k_factor": 48,
    "rated_matches": 1,
    "last_rated_match_at": "2026-10-10T18:00:00+02:00",
    "updated_at": "2026-10-10T20:43:12Z"
    }

    Ola started at 1400, from a self-assessed NTRP level of 3.5. Winning that first match raised the rating by 32 and the confidence from 20 to 30.

You’ve made your first two requests to the KRKplaysTennis API.

© 2026 Saverio Cirillo · KRKplaysTennis is a fictional API · Built with Starlight