FileMaker 16 – cURL & JSON – Essential tools

With the recent release of FileMaker 16 the development community now has a powerful set of native tools that will facilitate connectivity with other applications via REST API’s. I am currently developing a file that integrates with the online music collection database Discogs and thought that I would share some thoughts on factors that would assist others in the community to develop their solutions.

When making a successful call for JSON data we are, by default, presented by an unformatted block of data that we are expected to interpret and mine for specific data components. There are some online tools that will cnvert [via cut and paste] such a data block so that it can be put to practical use.

One specific requirement when mining for data is to identify the hierarchy of stacked data so that we can create a specific cURL request. FileMaker 16 provides a native function JSONFormatElements that will represent data within FileMaker converting data as illustrated below (on the left we can see the raw data and on the right, the formatted version):

Formatting JSON in FileMaker

The conversion of data as highlighted above makes identification of specific data elements ‘sooo ‘ much easier. When it comes to extracting elements including  “title”, “label”, “year” etc from a given release in the returned JSON data we can see that this falls with the “releases” section. Having identified this I have then utilised the following script to extract and create records with these identified elements:

Parsing JSON in FileMaker

 

It is worth noting in relation to the above script are that the Variable $i is initially set to “0” as this will return the first iteration within the data set and not “1” as you might expect. It should also be noted that if you are mining for data falling within a further level of the “releases” section it should be segregated by a full-stop and the level name for example:
Set Field [Items_DISCOGS__create::d_Artist_Name ;
JSONGetElement (Discogs::d_cURL_Result ;  “releases.artists [“ & $i & “] name” ) ]

Interaction with a wide variety of online resources will further extend the functionality and importance of FileMaker applications in the marketplace. There are exciting opportunities ahead in the development community as we further explore the native tools that have been provided in FileMaker 16 in relation to JSON / cURL.

 

Simon Ward

Simon has been developing FileMaker databases since the late 90s and joined Linear Blue in 2006. Over this time he has developed database systems for clients in many different industries from Order Processing to Book Publishing. Simon’s BSc in Chemistry from Thames Valley University comes to the fore in his analytical skills and he is certified in FileMaker versions 7 through 12.

More Posts - Website

Leave a Reply