We are big fans of Paw here at Proof. Paw is an API tool that lets you create and test web API calls. The folks at Paw have done a pretty remarkable job of making the business of making API calls a thing of joy. If you are familiar with Postman, you’ll like Paw. While Postman is pretty cool, Paw has a few additional killer features that make it hard to beat for those of us who are primarily working in OS X.
Paw has several code generators already built in for different languages, but unlike Postman, Paw provides the ability to create or modify a code generator to work for specific needs. As a FileMaker-heavy shop, we were frequently tweaking Paw generated cURL snippets into a format that’s compatible with FileMaker’s “Insert from URL” script step. In our experience, this can be a repetitive, error prone exercise in chasing down quotes, carefully adding escape characters and substituting strings for variables.
We thought it’d be cool if we could copy the code directly out of Paw and into FileMaker without too much jiggery-pokery. And so, the FileMaker Code Generator for Paw was born.
To use the FileMaker code generator for Paw, go to your Paw application>Extensions>Install Extension and paste this in:
You can also search for FileMaker Code Generator via Paw’s extension web page like so,
https://paw.cloud/extensions?q=filemaker+code+generator and install it that way.
The Source Code
The Paw FileMaker extension is available via the online Paw Extension directory and can be downloaded from GitHub. We’ve released this as an open source project (MIT license), so please hack it, add to it, fork it, and most of all give us any feedback so we can make this better. You can read more about it here,README.md
Paw’s standard cURL code generator is already pretty close to the format required for FileMaker’s cURL Options. For example, copying a stock cURL snippet gets us something like this:
It’s close, but not quite.
First, it’s gnarly stuff to read and to parse. Second, it seems like our spiffy little Paw extension should (1) fix the quotes, properly escape them, and (2) substitute the parameter values in our snippet with placeholders FileMaker variables, which is exactly what we’ve done in this initial release.
Once you have installed the extension, you should see a ‘FileMaker’ option in your code generation selector. There are two parts to the generated snippet:
- the cURL Options code snippet itself
- the url of the endpoint.
We’ve also included trace and response headers to help with debugging when things go wrong. You don’t actually need the –trace-ascii and –dump-header flags but if you use them, just use your data viewer to show the $trace and $headers values while stepping through your script.
We’ve named user-defined header keys according to their header names in Paw; auth header keys get generated as “username”, “password” and “access_token”. In the url, query parameters are included in the snippet and the query values have been substituted with FileMaker variables with the same names. While v1 of the code generator it does not handle path parameters, we are looking at adding that in a future release.
The Paw FileMaker extension is available via the online Paw Extension directory and can be downloaded from GitHub.
Drop us a comment below and let us know what you think.