Tim Dietrich

Custom Software Developer

Home Services Portfolio Blog About Contact Newsletter

FM API Assistant: Integrate FileMaker With REST APIs

If you've done any API integration with FileMaker, then you're probably all too familiar with the limitations of the Insert From URL script step. While it does make it possible for you to make HTTP calls natively from FileMaker, it leaves a lot to be desired.

Limitations of Insert From URL

For example, Insert From URL can only make HTTP calls using the GET and POST methods. You cannot use many of the HTTP methods that most modern, RESTful APIs make use of, such as PUT, PATCH, and DELETE.

Also, there's no support for specifying HTTP header values, which many APIs use for authentication, content negotiation, and so on. And there's no way to specify a timeout value for HTTP requests that are made.

There are FileMaker plugins available that provide alternatives to the Insert From URL script step. However, those plugins can be costly, and present challenges for users accessing a database via WebDirect and Go.

FM API Assistant's HTTP Relay Function

I'm in the process of wrapping up an application that I've been calling FM API Assistant. It's essentially a helper application, which listens for HTTP POST requests. Those requests, which are sent to the app in a JSON-encoded format, define an HTTP request that the API Assistant is to make on FileMaker's behalf. Those requests can include:

• The HTTP Method to use, including GET, POST, PATCH, PUT, DELETE, HEAD, and so on.
• The server address that the request should be sent to, including the port.
• The protocol (HTTP or HTTPS) to use.
• Any URL parameters that should be sent.
• Any body content that should be sent for POST, PATCH, and PUT requests.
• The content type of the body content. For example, application/json.
• Header values that are to be sent with the request.
• The timeout value for the request.

For example:


{
  "method": "GET",
  "urlParams": {
    "maxRecords": "3",
    "view": "Main%20View"
  },
  "headers": {
    "Authorization": "Bearer key67Y21J123"
  },
  "protocol": "https",
  "serverAddress": "api.airtable.com/v0/appiU771127ulun1pWe/Prospects",
  "port": "443",
  "timeout": "30"
}

The API Assistant essentially acts as a relay. It receives the request from FileMaker, makes the HTTP request on FileMaker's behalf, receives the response, and sends the response back to FileMaker.

JSON Parsing With FM API Assistant's JavaScript Engine

Most REST APIs return their responses using JSON, and unfortunately, FileMaker does not yet have native support for parsing JSON. So I've also added a JavaScript engine to the API Assistant, which makes it very easy to parse a JSON object and transform it into something that FileMaker can more easily work with, such as delimited data. Of course, the JavaScript engine can be used for other purposes as well. To use the JavaScript engine, you simply send a block of JavaScript code to the API Assistant using Insert From URL, and the result will be returned.

Lots of Deployment Options

I've developed the API Assistant as a Xojo Web application. Therefore, I'll be making it available as a standalone and CGI application which can run on OS X, Windows, and Linux, and as both a 32-bit and 64-bit application. You can specify what port the API Assistant should listen on, so you can avoid conflicts with other services running on the same server. (You could run it alongside FileMaker Server if you'd like).

Coming Soon

In terms of licensing, I'm still working through the details. There's a good chance that I'll make the application available free of charge, and only charge for support. We'll see...

In any case, I'm planning to release the FM API Assistant sometime next week. If you're interested in it, stay tuned to my blog and Twitter, or signup for my newsletter.