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.

 

Gwyn Jenkins

Gwyn Jenkins

Gwyn joined Linear Blue in April 2013 as a Senior FileMaker developer with previous experience of Operations and Project Management he has a wealth of experience in designing and creating bespoke business solutions based upon FileMaker database technology. He has applied his knowledge and experience in creating successful solutions in a wide variety of industries including print, food ingredients, commodity trading, architects and event management.

More Posts - Website

Leave a Reply