Run scripts
To run a script, send a POST request to the Script system table, followed by the name of the script in the URL. The POST body must be completely empty if the script does not take a parameter, or it must contain a single field named scriptParameterValue if a parameter is passed to the script. The scriptParameterValue accepts string, number, and JSON object type values.
OData doesn't support script names with special characters (for example, @, &, /) or script names beginning with a number. If the script contains the Exit Script script step, the text result of Exit Script is returned in a field named resultParameter in the results.
The HelloScript script appends the parameter value to the string "Hello" and returns the result. OData returns the result in the response body with a Content-Type of "application/json":
{
"scriptResult": {
"code": 0,
"resultParameter": "Hello World"
}
}
Note OData only supports scripts that run without user interaction.
Component | Description |
---|---|
HTTP method |
POST |
URL |
https://host/fmi/odata/version/database-name/Script.script-name host – FileMaker Cloud or FileMaker Server host name version – the OData version, always database-name – the name of the hosted database script-name - the name of script Example: The request above runs the HelloScript script with a parameter value |
Parameters |
JSON example: Copy
|
FileMaker information
-
To conform with the OData concept of an action, all scripts are members of a system table named Script.
-
When OData runs a script, the script is run as a server-side script. See About running scripts on FileMaker Server and FileMaker Cloud in FileMaker Pro Help.