This site uses tracking cookies. By using this site, you agree to our Privacy Policy. If you don't opt in, some parts of the site might not function.
Blog
Home / Blog / FileMaker / FileMaker Server 16: FileMaker Data API
12May 2017

FileMaker Server 16: FileMaker Data API

About the Author

Wim Decorte Wim Decorte

Wim is a Senior Technical Architect at Soliant. He is a FileMaker 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16 Certified FileMaker Developer and the author of numerous Tech Briefs and articles on FileMaker Server. Wim is one of the very few multiple FileMaker Excellence Award winners and was most recently awarded the FileMaker Community Leader of the Year award at the 2015 FileMaker Developer Conference. He is also a frequent speaker at the FileMaker Developer Conference and at FileMaker Developer groups throughout the world. In addition to being a renowned expert on FileMaker Server, Wim also specializes in integrating FileMaker with other applications and systems. His pet project is the open source fmDotNet connector class that he created.

Comments (23)

Gianluca - May 17, 2017

Hi, thanks a lot for this very useful article.
It works a treat!

The question that I have is how can I build a Filemaker to Filemaker data exchange with this?
Let’s say I have a Filemaker Go file that I want to sync with the database shared in FMServer, I could use the GET to retrieve all the records I need and load them into the Filemaker Go file. I was thinking of a text field in the FMGo file that I set with the “Insert from URL” instruction so I can get the data and then split them into a local table.

Do you think is possible?

Thanks a lot!
Gianluca

Reply
    Wim Decorte
    Wim Decorte - May 17, 2017

    Hi Gianluca,

    Thanks for the feedback. Yes; as a concept that would totally work. Note that ‘insert from URL’ now supports setting a variable directly so you wouldn’t have to store it in a field.

    One thing to keep in mind: when the Data API is released officially it may come with a licensing cost so take that uncertainty into account when defining your strategy.

    Best regards,
    Wim

    Erik Wegweiser - November 3, 2017

    Actually, in order to learn the new Data API, for lack of any other technology, I started with a FileMaker file that easily created a record on the server through an API call. Great! But what next? What do I need to do to allow webhooks of a service (like ShipStation) to talk to my database via the Data API? Here, I don’t have the ability to custom specify everything needed to communicate. Where do you start from zero with (I think) Node.js (or what other Data API-compaible technology)?

      Wim Decorte
      Wim Decorte - November 8, 2017

      Hi Erik,

      The Data API as such is clearly defined, if you need more functionality to accommodate another service then typically we build a go-between in whatever technology is best for the job and/or fits the chosen technology stack of the client (PHP, Ruby, JS, C#, …). That also offers a nice layer of abstraction so that we switch out the backend without affecting what is exposed to the other service. Where do you start: pick a technology, tinker with it, find a trusted partner that can mentor you, join the forums for that technology.

Hans Erik Hazelhorst - June 21, 2017

Hi Wim,

Thank you for this excellent introduction and for taking the time to make this documentation. The data API looks very promising and following this intro is also valuable as a way to get accustomed with webservices in general, PostMan, and oAuth.

Two questions:
1. Is there a special reason why you use two fmp12 files for this example? I am a proponent of data-interface separation myself, but other that that, are there security reasons for this choice?

2. I heard recently that the RestFM solution from Goya Ltd (which uses the PHP API) is preferred by some developers because it has better security and other features. Notably, the ability to run scripts as part of a API call handling. Do you have any ideas on that issues that may help me choose one solution over the other?

Beste Regards,
Hans Erik Hazelhorst

Reply
    Wim Decorte
    Wim Decorte - June 21, 2017

    Hi Hans,

    Thanks for the feedback.
    No special reason for the data separation in this demo, except that I wanted to verify that it works ok for those types of deployments. No security reasons.
    We have used RESTfm in various projects over the years and will continue to evaluate it for the task at hand. One of the major drawbacks of the new Data API clearly is that we can’t run scripts. We can still do it through the XML API if need be while using the new API. For us it is mostly the uncertainty around the Data API licensing model that could prevent us from using it. It’s security is good though so that would not turn us away. RESTfm does offer some more options all around.

Roger Jacques - July 2, 2017

Thanks for the great summary Wim!
If I understand correctly, FMI has chosen to use Put for sparse updates, rather than Patch. I wonder what the thinking behind that is, if you happen to know.

Reply
    Wim Decorte
    Wim Decorte - July 6, 2017

    Thanks, Roger.

    No, don’t know why they chose Put over Patch. But since this is a beta, we have an opportunity to provide feedback and share our own preference for one over the other. This is a good place to put it and get people to vote it up: https://community.filemaker.com/community/discussions/product-ideas

    Best regards,
    Wim

Christian Breu - July 18, 2017

What could be the problem, when using the url of a container field retrieved by a api call to fill a local container field by insert from url and the data in that field is corrupted?
It looks like the perfect match but seems not to work. When inserting the url in a web browser downloaded file can be opened, when inserting from url, the file gets broken.

Reply
    Wim Decorte
    Wim Decorte - July 18, 2017

    Hi Christian,

    Go ahead and post the question on community.filemaker.com or fmforums.com. Many of us are on those forums and others can chime in too with ideas and things to try.

    Best regards,
    Wim

rjakesgravatar - July 22, 2017

Thanks Wim!

I entered an idea that explains the RFC standards a bit, and why they should be followed.

A standards compliant implementation of PUT would actually be a great way to “reset” a record, in that leaving a column out of the PUT payload could indicate that you want the auto enters to fire (without regard to the dependency tree.) Either way though, RFC clearly says that sparse updates should be PATCH.

https://tools.ietf.org/html/rfc5789

https://community.filemaker.com/ideas/2608
Please upvote.

Reply
Steve - November 29, 2017

Thanks Wim – just wondering in the Postman collection is there a way to update the {{server}} in the URL in one place without having to update each request, e.g.:

https://{{server}}/fmi/rest/api/record/the_UI/FRUIT_utility

I would like to change this to:

https://localhost/fmi/rest/api/record/the_UI/FRUIT_utility

and the same for all the other requests in the collection. Is this possible in Postman?

Reply
    Wim Decorte
    Wim Decorte - November 30, 2017

    I you mean a replace across the collection to get rid of the variable, then: probably not. But it’s easy to just set the value of “localhost” to the {{server}} variable. That way you can do the same tests against different server IPs or server names and just change the variable once. Here’s an intro to using variables: https://www.getpostman.com/docs/postman/environments_and_globals/variables

Steve - February 7, 2018

I’m trying to get confirmation of the date format used by the REST API – haven’t found any mention of this in the API docs so far. I’m assuming it is MM-DD-YYYY – is that your understanding of this?

Reply
    Wim Decorte
    Wim Decorte - February 7, 2018

    This is how a date and a datestamp field are returned:
    “date_field”: “09/07/2016”,
    “timestamp_field”: “09/07/2016 10:22:40”,

    Note that the Data API makes no attempt to match the FM field data types to JSON data types, it just sends everything as text, so everything is preserved as it is in FM.

Steve - February 7, 2018

Thanks Wim – I was more concerned with the request/find format when searching on a date – do you have to specify the date in the MM/DD/YYYY format instead of your local format, e.g. DD/MM/YYYY in the UK?

Also do you know if each Data API request triggers the OnFirstWindowOpen script trigger and the OnLastWindowClose as well?

Reply
    Wim Decorte
    Wim Decorte - February 12, 2018

    Hi Steve,

    I haven’t done any research into search locale formats, but since FMS expects everything as json text and responds in nothing but json text format I would assume that you can specify it in your locale.
    Calls to the Data API do not trigger any scripts in FMS, the Data API talks straight to the database engine and does not pass through the FMS scripting engine.

Steve - February 12, 2018

Thanks Wim – from my testing here with UK dates if I have a date entered in the database as 30/11/2017 it is returned in US format:

“Date”:”11/30/2017″

And when performing a find query it only works when specifying the MM/DD/YYYY date format for a date.

Reply
    Wim Decorte
    Wim Decorte - February 16, 2018

    Thanks for sharing that!

Job - April 30, 2018

Great article. Learned a lot, just what I needed actually. Really appreciated you included the FM files and info about Postman.
Thanks!

Reply
Pitisak Walbolt - August 20, 2018

Hello – Just starting to do some work with the fm api. this is a great article that helped me get started.

One thing I am trying to do is to make one call with mutliple rows. Example my first call post to create a record for a parent record. Now my second call goes to a child table that could have 1 record or multiple records. Will the filemaker Api handle this wor do I have to send each child record separately?

Reply
    Wim Decorte
    Wim Decorte - August 21, 2018

    Hi, glad you liked the article.
    If there is a portal on your target layout then you can manipulate the existing child records in one call. I believe you can only create one related record per call though.

Leave a Reply