Skip to main content
RequestScript is a small, strictly typed scripting language with syntax inspired by TypeScript and Kotlin. Instead of calling a fixed set of API endpoints, you send a short script in the body of an HTTP request, and the server runs it and returns the result as JSON.

Two kinds of scripts

Every RequestScript script is one of two kinds:

Requests

One-off scripts. You send a request, the server runs it once, and you get the result back. Requests take no parameters.

Contracts

Named, versioned scripts that you save on the server and invoke later with JSON parameters.

What scripts can do

A script works with values (numbers, strings, booleans, objects and lists), makes decisions with if statements and returns a result. To do anything beyond computing a value, such as reading data or calling another system, a script uses resources: named sets of functions that the server makes available.

Design at a glance

  • Strict types. Every variable has a type that never changes, and values are never silently converted. A string is never treated as a number, and if (1) is an error.
  • Exact numbers. Integers never wrap around, and decimal arithmetic is exact, so 0.1 + 0.2 == 0.3 is true.
  • Deliberately small. There are no loops and no user-defined functions. A script runs from top to bottom and returns a value.
  • Recoverable resource failures. A failing resource call hands the script an error it can inspect, instead of failing the whole request.

Next steps

Quickstart

Run your first request and save your first contract.

Language guide

Learn the syntax, types, variables and operators.

Resources

Call functions that the server makes available.

HTTP API

Every endpoint for running scripts and managing contracts.