Guess the word,
build the game
One word a day, five letters, six guesses, the same word for everyone in this room. The word never leaves the server. You send a guess, the API sends back three colours, and everything else is yours to build.
Five tumblers, one word at a time. Drag them sideways.
Checking the API
Three calls, that is the whole API
Every answer has the same shape: { data, error, meta }. On a failure data is null and error is a sentence you can show your player. CORS is open and there is no key, so an index.html on your own disk can talk to it. Sixty requests per minute per IP.
Ask for today's game
You get a gameId back, not a word. Keep it, every guess needs it. A practice game works the same way but uses a random word and never counts for the board.
const res = await fetch("https://wordle.svsit.nl/api/game/today");
const { data } = await res.json();
// data.gameId, data.date, data.wordLength, data.maxGuesses
Send a guess, get colours
Five letters, a to z. You get one status per letter: correct for the right letter in the right place, present for the right letter somewhere else, absent for a letter that is not in the word. A word outside the list is not an error: valid is false and result is null, so shake the row and give the guess back.
const res = await fetch(`https://wordle.svsit.nl/api/game/${gameId}/guess`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ guess: "crane" }),
});
const { data } = await res.json();
// data.valid, data.result, data.solved
Put your team on the board
Only the daily game counts. Send the number of guesses and the time it took, and you get your rank at that moment. The button below only reads the board, posting a score is yours to do.
await fetch("https://wordle.svsit.nl/api/scores", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ teamName: "Team SIT", guesses: 4, timeMs: 84000 }),
});
// and to read it back: GET /api/scores/today
What makes a client good today
The API is done, so the game itself is not the hard part. These are the things that are actually visible to somebody else.
- It plays without a mouseLetters, Backspace and Enter on a keyboard, and every button reachable with Tab.
- The colours are also wordsGreen and yellow are invisible to part of your audience. Say the result in text as well, in a live region.
- A wrong word does not cost a guessA response with
valid: falsemeans give the row back, not burn it. - It says what went wrongShow the sentence in
error. That includes the rate limit, so do not hammer the API in a loop. - It survives all six guessesWinning is easy to handle. Losing, reloading and starting a practice game are where clients break.
- It looks like a decisionAnything can be dark grey with rounded corners. Pick something and hold it.
The demo client
A working client on this same API, built to be read rather than copied. Grid, on screen keyboard, spoken results, the leaderboard, and the same tumblers spelling out the word when you win. The source is four small files next to this page.