By: Doug West
**Requires FileMaker Pro 16
Lookup the city and state for any ZIP Code quickly and easily using JSON data from the Ziptastic web service API with FileMaker Pro 16.
Ziptastic is a simple web service for accessing geolocation data associated with postal codes. The API provided at getziptastic.com supports postal codes in 70 countries. By sending a US-based ZIP Code in a URL, we can quickly and easily get the associated city, county, and state. This service replaces the hassle of creating and updating an offline reference for postal codes.
We first provided the Ziptastic tip file for this web service roughly four years ago as a demonstration of the Insert From URL script step that was introduced in FileMaker Pro 12. Enhancements in FileMaker Pro 16 now allow us to simplify this process even more. Let’s take a look at the fundamental differences:
OLD Way (FileMaker Pro 12+)
- Insert From URL script step returns JSON results to a global field
- Separate script is called to parse field values out of the JSON data object
NEW Way (FileMaker Pro 16+)
- Insert From URL script step returns JSON results to a global variable
- JSONGetElement function is called to parse field values out of the JSON data object
We have eliminated the script for the JSON parsing and the global field we were using to store the response from the Ziptastic API. Adding this feature to a solution now requires only one script and no additional fields. The script can be triggered when the user exists the ZIP Code field, and the city and state will be looked up so the user doesn’t have to enter them manually.
The Ziptastic service continues to be free for up to 100 requests per day, but now offers premium service levels for higher usage. The revenue generated by the subscriptions allows them to update the data monthly instead of only twice a year. Additional details for this web service can be found at getziptastic.com, but the concepts described in this tip are relevant to any web service using JSON as the data interchange format.
**This article is provided for free and as-is, use, enjoy, learn, and experiment at your own risk – but have fun! eXcelisys does not offer any free support or free assistance with any of the contents of this blog post. If you would like help or assistance, please consider retaining eXcelisys’ FileMaker Pro consulting & development services.
eXcelisys, Inc. is an independent entity and this web site/information/blog post has not been authorized, sponsored, or otherwise affiliated with FileMaker, Inc. FileMaker is a trademark of FileMaker, Inc., registered in the U.S. and other countries.
The post [FMP Tip-n-Trick] Ziptastic Revisited Using FileMaker Pro 16 appeared first on eXcelisys.