esolang

HTTP API

JSON over HTTP, the same routes the pages use, with no authentication.

The examples call a local server (shib serve --online). The public site answers the same paths under https://esolang.dev.

B=http://127.0.0.1:4173

Every route

The server's own table (ROUTES in museum/server/routes.js), public rows only. GET /api returns the same list as JSON.

methodpathanswers
GET/apiThis table as JSON
GET/api/zooThe substitution languages with one example each
POST/api/zoo/run{ id, program, input } -> { source, output } on the language's reference interpreter, 200,000 steps
GET/api/kitThe probe inputs of the behaviour kit
POST/api/kit/nearest{ outputs } -> the five nearest known behaviours
GET/api/challengesThe challenges by level, each with its description, an example, tier and source
GET/api/challenges/:idOne challenge in full, without its held-out cases
GET/api/tasksEvery task with its examples
GET/api/metaModel variants, program length limits and the kernel version hash
GET/api/modelsThe public models, each with its family, its line and what was measured
POST/api/made/run{ id, input } -> a made program run again

A failure is {"error": "..."}, usually with a 4xx status. A wrong method gets 405. Online, each visitor may make 60 POST runs a minute; past that the answer is 429 with Retry-After.

The route table

curl -s $B/api
[{"method":"GET","path":"/","wing":"lobby","doc":"The front page","api":false}, …]

Run a program

POST /api/zoo/run with { "id", "program", "input" }. The program is brainfuck (or Deadfish, for a Deadfish language); the server writes it in the language id, runs it and returns both.

curl -s -X POST $B/api/zoo/run -H 'Content-Type: application/json' \
  -d '{"id":"nope","program":"++++++++[>++++++++<-]>+.+.+.","input":""}'
{"source":"Nope! Nope! Nope! … Nope!","output":[65,66,67]}

output is bytes. A program out of steps returns "output": null with "why": "steps" and what it printed so far as partial. This route runs the 99 spellings of brainfuck and Deadfish, which Brainfuck in disguise and Deadfish in disguise show side by side. Every other language runs in Run or with shib.

The languages

GET /api/zoo gives every spelling of brainfuck and Deadfish, with its words, what each means, its esolangs.org page and a worked example.

curl -s $B/api/zoo
{"languages":[{"id":"nope","name":"Nope!","family":"brainfuck","tokens":["Nope. Nope. Nope. Nope!", …],"commands":[">","<","+","-",".",",","[","]"],"joiner":" ","source":{"page":"Nope!","url":"https://esolangs.org/wiki/Nope!"}}, …],
 "examples":{"nope":{"base":"++++++++[>++++[…","source":"Nope! Nope! …","output":[72,101,…]}}, "heldout":[…], "strata":{…}, "rule":"…"}

The challenges

GET /api/tasks gives the 48 challenges a world is scored on, with their examples as bytes. train is what a learner may see, heldout and heldout2 what it is tested on. Shibboleth's Challenges page lists them.

curl -s $B/api/tasks
[{"id":"one-letter","group":"first","train":[{"input":[],"output":[65]}],"heldout":[],"heldout2":[]}, …]

Match a program's behaviour

The test kit compares a program's behaviour with 463 known ones. GET /api/kit gives the 18 probe inputs as bytes; run the program on each and send its 18 outputs, in order, to POST /api/kit/nearest as { "outputs": [[...], ...] }. The answer is the five nearest behaviours.

curl -s $B/api/kit
{"probes":[[],[97],[104,101,108,108,111],[52,50], …]}

A program that prints its input back sends the probes themselves.

curl -s $B/api/kit | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>process.stdout.write(JSON.stringify({outputs:JSON.parse(s).probes})))" \
  | curl -s -X POST $B/api/kit/nearest -H 'Content-Type: application/json' -d @-
{"ranked":[{"id":"cat","family":"classic","similarity":1},{"id":"trim","family":"text-filter","similarity":0.9955}, …]}

Files

GET /p/<path> gives any public file of the project, read-only, by its path from the root. The pages load the interpreters this way, and a script can too. Data lists the files worth downloading, with their licences.

curl -s $B/p/langs/data/languages.json
curl -s $B/p/tools/catalog/catalog.json
Routes left out online

Routes that write (saving a world, favourites, comparisons) and routes for local runs answer 404 on a server started with --online. Which ones is decided in online.json; node tools/online.js lists them.