JSON Manipulation using JSONata
Having created recent videos about accessing APIs via REST, and extracting the free JSON data as well, it would be a glaring omission if I didn't address our need to manipulate the JSON FileMaker provides us with. Yes, the work to put your FileMaker data into structured JSON has already been done. But, the JSON you need for your designated API is always going to be different than that.
Fortunately, we have access to the amazingly powerful and fast JavaScript engine built into each and every Web Viewer. What we need to capitalize on are the free open source libraries which help us get the results we need.
JSONata is a long standing powerhouse when it comes to manipulating JSON within JavaScript. Updates as recently as two years ago, to the eight year old library, moved it from a more linear synchronous model to an async model. This means we need to learn a bit about JavaScript promises and how we can use JSONata's own tools to easily manipulate our FileMaker JSON into what's needed. This video and the associated technique file will provide you with the tools which will help accomplish the integrations you're trying to solve.
- Read more about JSON Manipulation using JSONata
- 3 comments
- Log in or register to post comments
The "One" REST Script
When it comes to programming, there's always more to learn and share. If you've worked with REST APIs in the past, then you may have already devised your perfect system. If not, then this video will showcase a freely available script which you might want to consider first before trying to solve the problem yourself.
In our ever expanding world of coding to standards and systems, many of which have existed for decades, it's always prudent to see if you can beg, borrow and... Ok, don't steal... code which already does the trick. When it comes to HTTP's REST implementation we've already got all the code necessary.
Thanks to a great community contribution by Todd Geist, you really don't need to fumble through all the variations and possibilities of HTTP's REST methods used by FileMaker's cURL features found within the Insert from URL step. Todd and company did the heavy lifting and made an open source file available to everyone.
In this video I showcase my own personal enhancements to the script and provide some insight into some of the ways I code and why I do the things the way I do.
- Read more about The "One" REST Script
- 2 comments
- Log in or register to post comments
Easy JSON Record Data
Coding software solutions offers the fascinating realization that there are always multiple pathways to achieve the same goal. Sometimes the methods we're familiar with may not be the most optimal, prompting us to expand our knowledge to explore alternative approaches.
This video explores precisely that theme - the comparison between older and newer methods of accomplishing the same task. The advantage lies in the fact that newer methods often come with additional features or benefits. This is particularly true when it comes to obtaining the current record data as a JSON object. Historically, we've relied on ExecuteSQL to extract field names and values from the current record or a set of records.
In this video, I delve into the existing options using ExecuteSQL for creating a JSON object of the current record data. This method is effective in various scenarios. However, accessing related data can be time-consuming, especially when constructing SQL joins accurately requires significant mental effort. Unless you're a SQL expert, this may not be the most efficient use of your development time. Fortunately, recent versions of FileMaker have streamlined the process, making it exceptionally easy, with an alternative method, to extract any data from any record and convert it into the precise JSON object needed for passing parameters or interacting with external APIs.
- Read more about Easy JSON Record Data
- 10 comments
- Log in or register to post comments
Insert From URL cURL Options
Do you need to work with online APIs and find yourself wishing there was an easy way to accomplish it? Well, there actually is. In fact, in much of technology, there's something or someone somewhere which has likely already solved the problem.
In the case of using REST (Representational state transfer) to interact with service APIs within FileMaker, it's nice to have a single tool which will handle most of the heavy work for you. When native JSON was added to FileMaker, the last piece to the puzzle was a more expanded method of interacting with the network. The cURL library was already being used by FileMaker and it was simply a matter of "opening things up" so developers could use the full suite of the cURL library.
By adding the cURL options calculation to the Insert From URL script step the world of the web opened up for our humble FileMaker Pro.
This video provides a comprehensive understanding of how curl is integrated into FileMaker and how you can use a freely provided script to manage all your REST based interactions. Knowing about HTTP status codes and request/response headers is what you'll find covered in this video and the associated file.
- Read more about Insert From URL cURL Options
- 4 comments
- Log in or register to post comments
Detecting Data Changes
Here's an interesting dilemma. How do you track when specific fields are modified and adjust your JSON object so it only includes the data which was modified? Or, how about knowing when a user has modified specific fields, then having the user interface direct them down a different path than if they had modified others?
In both situations, you simply need to know when a field was modified. Using the Get ( RecordModificationCount ) function we can know THAT a given record was modified and using a modification field we can know WHEN it last happened. What we don't know is when only a specific set of fields is modified. We also may need to know exactly which fields were modified in order to take some type of action. This is where Detecting Data Changes is quite helpful. There are a number of ways this can be accomplished and the solution, as always, depends on what your needs are.
In this video, I showcase a method I use to detect data changes and then generate a JSON object based on specific fields which were changed. If you find your solution needing to work with an external API or needing to simply know when certain fields have been changed then you're sure to find some valuable info within this video and technique file.
- Read more about Detecting Data Changes
- 2 comments
- Log in or register to post comments
Google Maps APIs
Unless you've got a billion dollars to send out tens of thousands of cars with specially fitted technology mounted on their roofs; and, you can send them all across the planet, then you'll likely need to rely on mapping data from a third party.
So, here we go with learning how we can leverage Google Maps APIs within FileMaker. This video will cover the essential knowledge you need in order to make the requests about geolocations whether they be latitude longitude coordinates or an address.
As you've likely used Google Maps within the web browser, it's great to know you can access that same data directly within FileMaker; even the traffic data. It's just a simple matter of creating the right url. Making a request for what you want, and then parsing the data right back into your FileMaker table. Let's learn about the process and wire up the technology!
- Read more about Google Maps APIs
- 1 comment
- Log in or register to post comments