HTTP Script
A modern, JSON-based HTTP client for FileMaker that simplifies complex API requests by providing a fetch-like interface over FileMaker's Insert from URL script step.
Introduction
FileMaker's built-in "Insert from URL" script step provides basic HTTP functionality through cURL commands, but constructing complex requests requires string concatenation and careful character escaping, which can be error-prone and difficult to maintain. The HTTP Script addresses these challenges by providing a more developer-friendly interface inspired by the web standard fetch API.
Instead of manually building cURL command strings, you can now structure your requests using JSON objects - a format that FileMaker handles naturally. The script takes care of all the complex string manipulation and character escaping behind the scenes, converting your JSON request configuration into the appropriate cURL commands for FileMaker's Insert from URL step.
Key Features
- Flexible Data Handling: Supports multiple data formats and content types, including JSON, binary, and form data.
- Comprehensive Response Processing: Extracts and formats response headers and body, handling various content types and attachments.
- Debugging Support: Provides detailed logging of requests and responses when debugging is enabled.
- Error Handling: Captures and processes errors, ensuring robust execution.
Usage
To use this script, call it using the FileMaker "Perform Script" step:
Script Parameter
The script accepts a single JSON object parameter with the following properties:
| Property | Type | Description |
|---|---|---|
url | string | The URL to send the request to |
query | object | (Optional) Name-value pairs for URL query parameters. For nested querystrings, use |_ and _| to represent [ and ] |
headers | object | (Optional) Key-value pairs for request headers. Example: { "Accept": "application/json" } |
auth | object | (Optional) Basic authentication credentials |
auth.user | string | Basic auth username |
auth.password | string | Basic auth password |
data | string/object | (Optional) Data to send with POST, PUT, PATCH requests. For nested form-urlencoded data, use |_ and _| to represent [ and ] |
Return Value
The script returns a JSON object with the following structure:
| Property | Type | Description |
|---|---|---|
response | object | The successful response object |
response.ok | boolean | True if the response code is in the 200-299 range |
response.code | number | HTTP status code |
response.status | string | HTTP status message |
response.headers | object | Response headers |
response.body | any | Response body content |
response.trace | object | (Optional) Request trace if options.trace = true |
response.duration | object | (Optional) Request duration if options.duration = true |
Error Handling
If an error occurs, the script returns an error object:
| Property | Type | Description |
|---|---|---|
error | object | The error object |
error.errorCode | number | Error code |
Debug Mode
Set the $$ENV_DEBUG_HTTP variable to enable detailed request/response logging.
Resources
The HTTP Script is part of the mfm-http project, which is available on GitHub. You can find the sample file and test file in the repository:
📦 GitHub Repository: proofgeist/mfm-http
The repository includes:
- Sample FileMaker file (
mfm-HTTP.fmp12) - DDR XML export (
mfm-HTTP.xml) - Latest version: 2.0.0 (Released March 17, 2025)