Blog

Software tips, techniques, and news.

FileMaker cURL Options

One of the most important and wide-reaching updates as of FileMaker 16 is the ability to set cURL options in the Insert from URL script step. This allows FileMaker to natively integrate with innumerable services across the web, including Google Calendar, Google Maps, Microsoft SharePoint, and many other services.

youtube-preview

What is cURL?

cURL stands for ‘Client URL Request Library,’ or just ‘Client for URLs,’ and it’s a way to interact with data across devices around the world with many different protocols, such as HTTP, FTP, etc. FileMaker 16 allows users to specify headers, set request types, receive response codes, among many other things.

HTTP response codes are important because they let you know whether your operation ran correctly or not. If you get a code back that starts with 2, you know it succeeded (e.g. 200). Any other code, it failed (e.g. 404). Checking the response code is a necessity in REST APIs.

FileMaker cURL in Action

Using the Integrating FileMaker with RESTful APIs file, we’ve updated it to now use Insert from URL with cURL options instead of the BaseElements plugin. We can now natively perform all of the HTTP CRUD functions AND get responses and set HTTP headers, which wasn’t possible before FileMaker 16. Because plugins aren't necessary, that also means that users on FileMaker Go, WebDirect, and even Custom Web Publishing have the same power the desktop app is capable of.

So what does it look like?

FileMaker 16 updated the Insert from URL script step in a couple of different ways. First, they added cURL options that you can specify as a calculation:

FileMaker Insert from URL Options

Second, they opened up the Target to be either a field or a variable, instead of just a field:

FileMaker Insert URL Target

In our GIF above, our cURL options calc looked like this:

filemaker curl options calc

Let's break it down:

  • The "-X" means that we have a request. Note that cURL shortcuts are case-sensitive, so "-X" and "-x," for example, don't mean the same thing.

  • "POST" says what kind of HTTP request it is (create).

  • The "-D" means that we want a header dump.

  • The "$httpResponseHeaders" variable is where we want the headers dumped to. "--header" means we want to specify a request header.

  • "\"Content-type: application/x-www-form-urlencoded\""" says we we're sending the header as a string.

filemaker insert from url script step
The full Insert from URL script step with data.

After running the script, the HTTP status header we got back was:

filemaker curl http response headers

That's a lot of text, but the most important part is the first line: code 201 lets us know the record was created. Huzzah!

While this expands the functionality of FileMaker immensely, in taking a look at FileMaker’s supported cURL options, it's important to note that not all cURL options are available. However, given the importance of cURL and the power it brings, it's a great start.

Conclusion

FileMaker and cURL go hand-in-hand with allowing FileMaker solutions to natively interact with other platforms and services in ways that greatly improve its depth and scope. It gives all users, whether on desktop, mobile, Custom Web Publishing, or WebDirect, the ability to interact with external services through FileMaker without the need for plugins. If you need help setting cURL options in your FileMaker solution or want help integrating with 3rd-party web services, contact our team at DB Services.

Did you know we are an authorized reseller for Claris FileMaker Licensing?
Contact us to discuss upgrading your Claris FileMaker software.

Download the FileMaker CURL Options File

Please complete the form below to download your FREE FileMaker file.

First Name *
Last Name *
Company
Email *
Phone *
FileMaker Experience *
Agree to Terms *
eric church headshot.
Eric Church

Eric is an experienced Certified FileMaker developer who enjoys using his creativity to solve challenging problems in a manner that will exceed customer expectations. He is friendly, engaging, and skilled at helping people simplify the complexities of their workflow.