POST request to /run/ followed by its path and name. Pass parameters as a JSON object under the parameters key.
Build the URL
Replace each dot in the contract’s path with a slash, and end with the contract’s name:
Without a version, the latest version runs. See Versioning.
Pass parameters
The request body is a JSON object with aparameters object inside it:
- Every declared parameter must be supplied. Use
nullto pass no value. - Parameters the contract doesn’t declare are rejected.
- For a contract without parameters, send
{}or leave out the body entirely.
400 and a ParameterError:
How JSON becomes RequestScript values
Each parameter is converted from JSON to its declared type:
Numbers aren’t converted to strings, strings aren’t converted to booleans, and so on. A value of the wrong kind is a
ParameterError.
Sending large or precise numbers
JSON numbers lose precision in many clients once they go beyond about 15 significant digits. Forint64 and decimal parameters, send the value as a string to keep every digit. Whole numbers larger than 9,007,199,254,740,991 must be sent as strings: sent as JSON numbers, they’re rejected with a ParameterError.
Values inside objects
Anobject parameter has no declared types for its properties, so their types are inferred: whole numbers become int32, or int64 if they’re too big for int32, and other numbers become decimal.
The response
A successful invocation returns200 with the script’s return value: