While developing a Filemaker API Connector for BigCommerce and other API's I needed to be able to communicate with a fully RESTFul compliant API service. FileMaker's InsertFromURL is ok but had some big limitations when it comes to real world communication.
The problems with the existing InsertFromURL
- No Support for addition request types: DELETE, PUT
- No Support for Custom Header information
- Limited Error handling
API_Proxy.php is a PHP file that can reside on any server (Does not need to be local to your FMS) and can be called from any insertFromURL. Request Type (PUT, GET, POST, DELETE), Header information and the Request body are all passed via FileMakers insertFromURL Command.
Source code is on Github here: https://github.com/DelfsEngineering/FM_API_Proxy (Also v2)
See the comments in the PHP file for parameter format. Be sure to call API_Proxy.php with a POST vs a GET. Post calls can handle large parameter passing. Always check returned results for connection errors (FMP Get LastError) and also check the returned contents for connection and remote server process errors.
V2 Now supports file transfer
I had a situation where a fax sending service API needed all calls to come from known IP.'s The addition of file support solved this need perfectly.
1/18/2016 - Added support for &api_timeout= parameter that will allow scripts to not have to wait for unresponsive sites.
4/2/2016 - V2 Added support for passing files. This version is not 100% compatible with V1. Improved support for debugging and headers, New demo fmp12 file.