Using Postman Environments and Tests with the FileMaker Data API

One of the new features of FileMaker Server 16 and FileMaker Cloud 1.16.0 is the FileMaker Data API – currently in trial mode which expires on September 27, 2018. The FileMaker Data API is an application programming interface (API) that allows web services to access data in hosted FileMaker solutions and conforms to Representational State Transfer (REST) architecture, making the FileMaker Data API a REST API.

You can use the Data API to integrate your FileMaker solutions with other applications and services – REST APIs are the current standard for integration and the Data API will be the replacement for the current XML and PHP APIs.

Your web service or application calls the FileMaker Data API to obtain an authentication token for access to a hosted solution, then uses that token in subsequent calls to create records, update records, delete records, and perform find requests.The FileMaker Data API returns data in JavaScript Object Notation (JSON), another standard that is used with REST APIs for data formatting (and is also supported by FileMaker Pro v16).

A great tool to use when testing REST calls with the Data API is Postman, a free app for macOS, Windows and Linux (paid versions are also available). Postman allows you to make requests (GET, POST, PUT etc) to a REST API like the FileMaker Data API and inspect the response, including the headers. You can quickly make changes to the requests and headers that you send and compare the results – when working with REST APIs a tool like Postman is indispensable.

As mentioned above the FileMaker Data API requires you to obtain an authentication token when first accessing a FileMaker solution – the access token is valid until you log out of a solution or for 15 minutes after the last call that specified the token. While the token is valid, each call that specifies the token resets the session timeout counter to zero. To save you from having to manually copy and paste your token with each new request you can use some features of Postman to save your from having to manually update any variables in your requests manually, including the Data API access token.

Postman lets you setup multiple “environments” that can contain multiple variables fore each environment, such as the host address URL. For example you might have a development environment and a production environment, each with their own host address and other variables. In Postman I would simply have a POST request URL like this:

https://{{server}}/fmi/rest/api/auth/Tasks

and in each Postman environment I would specify the value for the {{server}} variable. When you make your request by hitting the Send button in Postman it will insert the appropriate value for each variable you’ve specified. You can read all about setting up Postman environments and variables in the Postman docs.

As you can’t specify the Data API access token in advance you can use another great feature of Postman to dynamically create the token variable which is then used in subsequent API requests. Your initial request to authenticate/login will look like this:

{ "user":"admin", "password":"admin", "layout":"Tasks" }

and if successful the response will look like this:

{ "errorCode": "0", "layout": "Tasks", "token": "fdde29fa175eb1cc8347512ca327b191619fc32ed65efaab26d8" }

Using the Tests feature when making a Postman request you can execute some JavaScript code after the request is sent to dynamically create a token variable that you can use with your subsequent API calls without having to copy and paste the token each time. Here’s a screenshot of how you would set this up in Postman for the Data API authentication request:

The JavaScript code you can copy/paste is:

var data = JSON.parse(responseBody);
postman.setEnvironmentVariable("token", data.token)

Using Postman environments and Tests to update the token variable makes working with the FileMaker Data API much easier and should save you a lot of time.

Webhooks are coming to Xero

Earlier this year Xero announced that Webhooks would be coming to the Xero API, which was exciting news for Xero developers who have been asking for webhooks support for a long time (there is a request from 2010 in the Xero API Customer Feedback site!). Webhooks allow you to subscribe to certain events that happen in Xero: the Contacts endpoint was the first to receive webhooks support and Xero have said they will quickly move to Invoices and other high-use endpoints (hopefully including Payments which our customers would love).

The events that are currently support for the Contacts endpoint are:

  1. Create: A new contact has been created
  2. Update: An existing contact has been updated (including when contacts are archived)

When one of these events are triggered the Xero API sends a HTTPS POST to the webhook’s configured URL – you can then perform the appropriate actions based on the contents of the webhook payload, such as creating a new contact or updating an existing contact in FileMaker.

Xero started a closed beta for the Contacts webhooks which Databuzz was lucky enough to be invited to join and we’ve been working on ways to implement webhooks with our fmAccounting Link (Xero Edition) solution, initially using the FileMaker PHP API. Databuzz has been working with webhooks for many years, for example adding webhooks support to our fmEcommerce Link (WooCommerce Edition) solution to allow new orders to be pushed automatically, and to fmSMS to allow incoming messages to be pushed to FileMaker without requiring users to download these manually. Adding webhooks support to our fmEcommerce Link solution was fairly straightforward – we created a PHP file that uses the FileMaker PHP API and processes the webhook payload to update the existing contact or create a new Contact as required.

We still need to polish these off but we wanted to demonstrate how you could use Contacts webhooks (and Invoices and other endpoints that are supported in the future) with our fmAccounting Link (Xero Edition) solution. If Contacts are created or updated directly in Xero and you need to make the same updates in your FileMaker solution web hooks will save you having to either re-enter these manually or downloads these from Xero via the Xero API.

Check out our video below (or on YouTube) that shows how you can use webhooks to have updates from Xero pushed automatically to fmAccounting Link (Xero Edition) (or your FileMaker solution that you have integrated this into). If you have any questions about webhooks and Xero please post them in the comments below or contact us directly.

Update November 30, 2017: webhooks for Invoices are now available.

fmAccounting Link (MYOB AccountRight Edition) Updated for Purchase Orders

An updated version of fmAccounting Link (MYOB AccountRight Edition) has just been released which now includes examples for working with Purchase Orders, which has been a popular request from our customers. fmAccounting Link shows you how you can use FileMaker to:

  • download Purchase Orders from MYOB to FileMaker (all Purchase Orders or filtered by Purchase Order Date)
  • create Purchase Orders in FileMaker and upload them to MYOB
  • update a single Purchase Order from MYOB

This is a free update for all existing customers. You can view the full release notes on our version history page.

Our next update will include examples for working with Bills in MYOB and FileMaker. We’re also planning an update that will be ‘plug-in free’ for FileMaker v16 users, allowing you to use the fmAccounting Link (MYOB AccountRight Edition) solution natively under FileMaker Pro,  FileMaker Go and FileMaker WebDirect without having to install and manage plug-ins. The FileMaker v16 platform introduced some new cURL options and JSON functions which will allow us to perform the same functions as the plug-in provides when using FileMaker v16 – earlier versions of FileMaker will still need to use the plug-in functions.

If there are other features you would like to see in the core fmAccounting Link (MYOB AccountRight Edition) file please get in touch and let us know.

fmAccounting Link (Xero Edition) and Public Application Integrations

When we released fmAccounting Link (Xero Edition) back in 2014 we developed it to be used with a Xero API Private Application – this made the most sense at the time and still does for most customers who are only concerned with connecting their custom FileMaker business app with their own Xero organisation. Private Applications are just one of the three different types of API Applications available for the Xero API:

  • Private – connected to a single Xero organisation, doesn’t require user authentication
  • Public -connect to multiple Xero organisations, requires user authentication, 30 minute access limit
  • Partner– connect to multiple Xero organisations, requires user authentication, long term access

One of the main advantages of a Private Application is that your FileMaker users do not need to have a Xero account, so you can allow them to perform specific functions (e.g. uploading Contacts, Invoices, Payments etc from FileMaker to Xero) without having to get them access to Xero itself – the Private Application handles the authentication with Xero for them. This means you don’t have to worry about giving access to confidential business information contained in Xero to all FileMaker users.

There may be times however when you wish to only allow Xero users to upload data from FileMaker to Xero – this would require the use of a Public or Partner application. Databuzz recently took part in Xero’s XD HAX Developer Challenge 2017 and we decided to use this opportunity to explore how a Public Application integration could work. We were focussed on integrating with FileMaker Cloud which runs on AWS and wanted to have a native solution that ran on all the FileMaker clients that FileMaker Cloud supports, including FileMaker Pro for Mac/Windows, FileMaker Go for the iPhone and iPad, and FileMaker WebDirect.

As FileMaker doesn’t have the native functions to perform the OAuth 1.0a authentication that a Private Application type uses we have used a FileMaker plug-in to handle the authentication with the Xero API. FileMaker plug-ins are only supported by the Mac/Windows FileMaker Pro client applications which means they cannot be used by FileMaker Go for iOS (though you can use the iOS SDK to create an iOS application based on FileMaker Go that can include the plug-in).

Using a Public Application type integration means we could remove the dependency on the plug-in as Public applications use the standard 3 legged OAuth process where a user can authorise your application – in Xero’s case this is for 30 minutes, at which point the access token expires.

For our XD HAX Developer Challenge entry we changed the authentication method to use a Public Application integration and took advantage of a number of native FileMaker features, such as using a Card Window to handle the Xero authentication window, and the new cURL and JSON functions to handle the encoding/decoding of data and uploading/download with the Xero API. Here’s a brief video demonstrating how a Public Application integration could work with our fmAccounting Link (Xero Edition) solution:

We would love to hear if this is something that you would be interested in seeing in a future version of fmAccounting Link. We love that we can provide a native solution that runs on all FileMaker clients without a plug-in but are not sure whether customers would prefer the long term access that a private application provides and the benefit of not having to use a Xero login to authenticate.

Xero User Magazine Custom Integration Article

Issue 12 of the Xero User Magazine was released today in time for Xerocon London where Xero announced they have now surpassed a quarter of a million subscribers in the UK, contributing to the more one million subscribers in over 180 countries.

We’re pleased to report that this latest issue of XU Magazine includes an article by Andrew Duncan of Databuzz on ‘The Benefits of a Custom Xero Integration’. You can find the article on page 110 of Issue 12 – you can subscribe for free to the print and digital editions here. The article discusses the benefits of a custom Xero integration, particularly when there is no add-on in the Xero App Marketplace that meets you needs. We also mention examples of integrations we’ve done for customers over the past four years that have helped them eliminate double data entry, for both FileMaker solutions and other applications.

Earlier this year we were approached by an Australian Government agency that was using three different software applications to handle online sales, point of sale merchandise and ticket sales and needed to get the consolidated data into their internal financial accounting software. Xero was used to reconcile all financial data which was uploaded by Vend each night and we developed a custom web application which ran every 24 hours to download the Invoices from Xero and generate a custom XML file which was sent to the internal financial application. This has been running smoothly for many months now and the customer is very happy about the time saved from not having to do any manual re-entry of financial data.

If you would like to discuss a custom integration with Xero please get in touch.

 

fmSMS Updated for Telstra Messaging API v2

Back in 2015 Telstra, Australia’s biggest mobile phone operator, launched a beta of their SMS Messaging API and fmSMS was one of the first commercial solutions to support the Telstra API. Telstra have recently released v2 of their Messaging API which includes a number of new features including:

  • dedicated number: you can provision an Australian mobile number for your account via the API
  • send SMS and MMS messages
  • receive messages to your dedicated number
  • delivery status: query the delivery status of your messages
  • callbacks: automatic notifications of message delivery status to a callback URL
  • alphanumeric sender ID support
  • concatenation: send messages up to 1900 characters long and Telstra will automatically segment and reassemble them
  • scheduled delivery: delay the delivery of submitted messages

Now that the Messaging API is out of beta there are a number of plans to choose from. You can start with a free trial which includes 1000 free messages and a dedicated mobile number. They also have a PAYG plan with no fixed term contract and messages are 6c per message, as well as an Enterprise plan.

You can download a trial version of fmSMS from the fmSMS website to test the Telstra SMS API using their Free Trial. When you purchase fmSMS you get the PHP files to use for automatic delivery status updates and automatic replies into fmSMS. Please contact us if you have any questions about fmSMS and the Telstra Messaging API.

fmEcommerce Link (WooCommerce Edition) Update August 2017

We’ve just updated fmEcommerce Link (WooCommerce Edition) – our solution for integrating FileMaker with WooCommerce – with a number of new features and bug fixes. We love getting requests from our existing customer base in many different countries and have included a few feature requests in the latest update, including:

  • Products: we added support for Grouped Products so you can now create and update these from FileMaker
  • Products: we added the ability to Delete a Product in WooCommerce from FileMaker
  • Products:  you can now view Product Images using a Webviewer (you no longer need to download Images into Container field to View them)

We’ve had a number of requests for the ability to create an Order in FileMaker and upload that to WooCommerce so it is available for customers to view when they login. We had been planning to add this in already so this will now be included in the next release – there’s quite a bit of work involved in ensuring the Order data is valid and gathering the correct line items, shipping lines, taxes etc, but we’re hoping to have this released in the next 4-6 weeks.

We’re also working on an update for FileMaker Pro v16 users to take advantage of the new JSON functions and cURL options in the FileMaker v16 platform – this will allow you to no longer need a plugin to communicate with the WooCommerce API, making it easier if you’re using FileMaker Go and FileMaker WebDirect and not having to use server side scripts.

This is a free update to all our existing customers – you can get the full details of the changes in the release notes for fmEcommerce Link (WooCommerce Edition). If you have any additional feature requests please get in touch.

fmAccounting Link (Xero Edition) Update August 2017

We’ve been busy over the last couple of months working on some updates to fmAccounting Link (Xero Edition) that fill in some missing gaps with the examples that we include in the fmAccounting Link (Xero Edition) file. For example we’ve always had examples for downloading:

  • Chart of Accounts
  • Tax Rates

from Xero into FileMaker, but some customers have asked for the ability to create and update these from FileMaker to Xero. We’re pleased to report that our latest update – v1.932 – now includes examples for creating Account Codes and Tax Rates in FileMaker and pushing these to Xero. You would typically apply some kind of access privileges around these features so that only authorised accounts users can perform these functions, but the functionality for this is now included in the core fmAccounting Link (Xero Edition) files.

We’ve also updated the Bank Transactions endpoint examples to support creating and updating Bank Transactions (spend or receive money) in FileMaker and pushing these to Xero. This update also includes some minor bug fixes – you can view all the changes in the version history notes.

Last month Andrew Duncan from Databuzz attended #XD17 – the Xero Developer Roadshow – in Melbourne, Australia. There were some great presentations on upcoming features for the Xero API as well as some cool demos showcasing some cutting edge Amazon Web Services integrations with Xero. Xero have also announced that Webhooks are coming to the Xero API, starting with the Contacts endpoint first then followed by Invoices (the two most popular Xero API endpoints). Databuzz have been invited into the closed beta of this and we’ve started work on a PHP solution using the FileMaker PHP API that will accept the incoming Xero Webhooks notifications and trigger an update in the fmAccounting Link (Xero Edition) file. We will post an article with further details about this when Webhooks becomes publicly available.

Xero have also just announced support for JSON when uploading data to Xero via the API – they have previously only supported JSON for downloads (GET requests). Now that FileMaker Pro v16 supports JSON natively this will allow us to add native support for uploading and downloading data between FileMaker and the Xero API.

We also get a number of questions about Invoice Numbers when pushing Invoices from FileMaker to Xero, so we’ve updated our list of Frequently Asked Questions with some details about the options you can use when pushing an Invoice from FileMaker to Xero and whether to allow Xero to generate an Invoice Number to have FileMaker push the Invoice Number across to Xero to use. We’ve also updated our FAQ to include a note about FileMaker Cloud support.

fmEcommerce Link (WooCommerce Edition) Now Supports WooCommerce 3.0

Earlier this year we wrote about the upcoming release of WooCommerce 2.7 and how it would be introducing a new version of the REST API (v2) with a number of new API endpoints, particularly for Product Variations. Shortly after our post WooCommerce decided to re-version 2.7 to 3.0 to better reflect the significance of this update and push the release date to the 4th of April, 2017.

Since the release of WooCommerce 3.0 we’ve been busy working on an update to fmEcommerce Link (WooCommerce Edition) to support the new v2 of the REST API and associated changes. We’re pleased to announce that v1.3 of fmEcommerce Link is now available as a free update for all existing customers (details have been sent via email about how to download this update). As v1 of the REST API has now been deprecated by WooCommerce we’ve decided to create 2 versions of the fmEcommerce Link file, one for each version of the REST API:

  • fmEcommerce Link (WooCommerce Edition) REST API v1.fmp12
  • fmEcommerce Link (WooCommerce Edition) REST API v2.fmp12

WooCommerce 3.0 is a major update and WooCommerce recommend that you ensure your store extensions and themes are compatible before upgrading, test on a staging site if you can, and make a backup for peace of mind. Since the 3.0 release on April 4th there have been 7 updates already fixing bugs with both WooCommerce and the REST API.

The major changes in fmEcommerce Link (WooCommerce Edition) 1.3 include:

  • now supports the WooCommerce REST API v2 only
  • Product Variations are now stored in their own table to match the new Variations endpoint (you can now update Variations independently of their parent Product)
  • added support for additional fields exposed by the v2 API for existing endpoints
  • added new Meta Data tables which are included with most of the API endpoints (Customers, Orders, Products etc)
  • added support for new Payment Gateways endpoint
  • added support for new Shipping Methods endpoint
  • added support for new Shipping Zone Locations endpoint
  • added support for new Shipping Zone Methods endpoint
  • fixed issue when uploading a Product with no Images when Product previously contained images

WooCommerce 3.0 supports both v1 and v2 of the REST API so you can upgrade to WooCommerce 3.0 and continue to use your existing version or integration of fmEcommerce Link and everything will continue to work as it did with WooCommerce 2.6. If you wish to take advantage of the new API endpoints (e.g. the ability to upload Product Variations separately to the parent Product) you will need to switch to the new v2 API and make some changes to your existing scripts etc using the examples from the fmEcommerce Link (WooCommerce Edition) REST API v2 file. If you are not planning to upgrade to WooCommerce 3.0 in the near future you do not need to make any changes.

All future development we now be focussed on the v2 REST API as that is the version that WooCommerce will continue to develop – we’ll certainly fix any bugs that arise with the v1 REST API. You can get the full details of all the change on the version history page.

Coming Soon – fmEcommerce Link (Shopify Edition)

Just over four months ago we released fmEcommerce Link (WooCommerce Edition), a FileMaker solution for integrating with WooCommerce. WooCommerce is a popular plugin for WordPress that powers over 39% of all online stores, including both the Databuzz Shop and the fmSMS Shop (you can read about how we came to develop fmEcommerce Link out of necessity here).

There are a number of other popular ecommerce platforms apart from WooCommerce, and we’ve had a number of requests to create a version of fmEcommerce Link for some of the more popular alternatives. Most of the requests were for a solution that integrates with Shopify, a leading cloud-based, multi-channel commerce platform designed for small and medium-sized businesses that is also popular with FileMaker users. Shopify currently powers over 400,000 businesses in approximately 175 countries and is trusted by brands such as Tesla, Red Bull, Nestle, GE, Kylie Cosmetics, and many more.

Shopify also has an established API that was suitable for integration with FileMaker, so it made sense for the next edition of fmEcommerce Link to work with Shopify. We’re in the final stages of development and testing but wanted to share some details of our latest product: fmEcommerce Link (Shopify Edition). You can subscribe to our newsletter to be notified when it’s released.

The initial release of fmEcommerce Link (Shopify Edition) will have the following features:

  • download Customers, Products, Orders, Shipping Countries, Locations and Discounts from Shopify
  • update existing Customer, Product and Order records from Shopify to FileMaker
  • download Orders between 2 dates
  • create/update a Customer record from FileMaker to Shopify
  • create/update a Product record from FileMaker to Shopify

Like our other products it will also have these features:

  • will work with FileMaker Pro v12, 13, 14, 15 and 16
  • can be hosted by FileMaker Pro or FileMaker Server
  • works with Macintosh and Windows
  • 100% unlocked for you to integrate into your own FileMaker solution

Here’s some more screenshots showing Customers and Orders downloaded from Shopify and the details for an individual Order:

We’ve put together a short preview video showing fmEcommerce Link (Shopify Edition) in action downloading Customers and Orders from Shopify to FileMaker. You can watch this below or via this link on YouTube: