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":

Copy
{
  "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 v4

database-name – the name of the hosted database

script-name - the name of script

Example: /fmi/odata/v4/ContactMgmt/Script.HelloScript

The request above runs the HelloScript script with a parameter value World.

Parameters

JSON example:

Copy
{
  "scriptParameterValue": "World"
}

FileMaker information