Curl HTTP Post from FileMaker

I was trying to test out some HTTP post transactions with the curl command, and things weren’t working.

One glitch was due to how the curl command parses its options. All characters, including spaces can be significant, so “-X POST” is not the same as “-XPOST”. This difference might be hidden if calling from the shell, which trims extraneous spaces in parameters, but I was calling via the bBox plug-in’s curl function, and this calls the command directly from FileMaker.

After dealing with some extraneous double-quotes that were in the data (cutting & pasting values a bit too quickly!) I ended up with a script step that looked something like this:

Set Variable Value:

[
$r;
Value:bBox_Curl (“-XPOST”; // use a http post transaction
“-d {‘type’:’sample_data’,’targetModule’:’bbox’}”; // data we are sending to http server
“-HContent-Type: application/json”; // desired result type, which is JSON
“http://httpbin.org/post”) // server handling our request
]

Simon

Leave a Reply