RequestScript

GET/about200 OK

A language for the body of a request

RequestScript is a small, strictly typed scripting language designed to be sent to a server, run, and answered with JSON.

Why RequestScript

Most APIs offer a fixed menu of endpoints. Every new screen, report or integration means another endpoint, or another round trip stitched together on the client. RequestScript takes a different approach: the client sends a short script in the body of an HTTP request, and the server runs it against the resources it chooses to expose.

Requests and contracts

Scripts come in two kinds. A request is run once and discarded. A contract is named, versioned and saved on the server, then invoked by path with JSON parameters. Contracts are immutable: to change one, you publish it again under a new version, so the logic behind every result is always known.

Small on purpose

The syntax borrows from TypeScript and Kotlin, so it feels familiar on first read, but the language is intentionally much smaller. There are no loops and no user-defined functions; a script runs from top to bottom and returns a value. Types are strict and never silently converted, integers never wrap, and decimals are exact. When a resource fails, the script receives the error as a value it can handle.

The implementation

The reference implementation, requestscript-js, is written in TypeScript and published to npm as requestscript. Its root export is the language (lexer, parser, interpreter and exact decimals) with no server dependencies. The requestscript/server subpath adds an Express HTTP server with Postgres-backed contract storage, and the package ships a requestscript-server executable.

The project

RequestScript is open source under the Apache License 2.0 and maintained with the Quallet team. Development happens in the open on GitHub, and contributors coordinate on Discord.