Run a script with another request
To run a FileMaker script as part of another request, include the script.prerequest, script.presort, and script parameters in the request body.
|
Parameter |
Value |
|
|
The name of the script to be run after the action specified by the API call (get, create, edit, duplicate, delete, find) and after the subsequent sort. |
|
|
The text string to use as a parameter for the script that was named by |
script.prerequest
|
The name of the script to be run before the action specified by the API call and the subsequent sort. |
script.prerequest.param
|
The text string to use as a parameter for the script that was named by script.prerequest. |
script.presort
|
The name of the script to be run after the action specified by the API call but before the subsequent sort. |
script.presort.param
|
The text string to use as a parameter for the script that was named by script.presort. |
Script execution order
You can specify the script.prerequest, script.presort, and script parameters on a single API call. Each keyword can be specified only once. The host processes these parameters as part of the API call in this order:
-
Go to the layout specified in the URL.
-
Perform the script named by
script.prerequest, if specified. -
Perform the action specified by the API call (get, create, edit, duplicate, delete, find).
-
Perform the script named by
script.presort, if specified. -
Perform the sort specified on the API call:
-
For Get a range of records, perform the sort specified by the
_sortparameter. -
For Perform a find request, perform the sort specified by the
sortparameter.
-
-
Perform the script named by
script, if specified. -
Return the result set for the API call, with the offset and limit parameters applied, if specified.
Notes
-
For calls that use HTTP GET and HTTP DELETE methods, the scripting parameters are included as URL parameters; see Get a single record, Get a range of records, and Delete a record.
For example:
https://<host>/fmi/data/v1/databases/customers/layouts/entry/records/14?script=UpdateProcessing&script.param=14 -
For calls that use HTTP POST and HTTP PATCH methods, the scripting parameters are included in the request body; see Create a record, Edit a record, and Perform a find request request.
For example:
{"query":[{"Title":"Office Manager"}], "script.prerequest":"Eliminate duplicates"} -
For the script parameters
script.param,script.prerequest.param, andscript.presort.param, you may specify only a single text string. To pass in multiple parameters, you can create a string delimiting the parameters and have your script parse out the individual parameters. For example, pass "param1|param2|param3" as a list with the "|" character URL-encoded as:param1%7Cparam2%7Cparam3 -
Script results are returned using the
scriptResult,scriptResult.prerequest, andscriptResult.presortparameters in the JSON data. Script errors are returned using thescriptError,scriptError.prerequest, andscriptError.presortparameters in the JSON data. (Script errors are not returned using an HTTP status code.)