Skip to main content
This guide walks you through running a one-off request and then saving a reusable contract. The examples use curl and assume a RequestScript server at http://localhost:3000. Replace that with your server’s address, and add any authentication headers your server requires.
1

Run a request

Send a request script as the plain-text body of POST /run:
The server runs the script once and returns the value it returned under returnValue:
2

Add some logic

Scripts can declare variables, compute values and branch:
3

Save a contract

A contract is a named script with parameters that the server stores for later. Save one with POST /contracts:
The server responds with 201 Created and the contract’s details:
4

Invoke the contract

Invoke the contract by posting its parameters as JSON to /run/<path>/<Name>. The dots in the contract’s path become slashes in the URL:
Contracts are immutable. To change one, save it again under a new version, such as contract greetings.Hello@2(name: string) { ... }. See Versioning.

Next steps