I used “Insert From URL” and the WooCommerce API to edit a product on my website. The response header included a 400 error and a reference to a “control character error.”
Troubleshooting revealed the culprit was spaces in the “short_description” variable string.
An internet search revealed, “To use a FileMaker variable that contains spaces (such as a JSON object) in a cURL request, you must use the @ symbol prefix inside the cURL options string. This tells FileMaker to treat the variable as a data source rather than trying to parse its contents as part of the command line, which automatically resolves issues with spaces and special characters.”
I use custom functions to build my curl options. In this case, I edited the -data curl custom function to add an @ prefix to the $variable name in an attempt to resolve the issue. However, this failed.
My second attempt was to append “@$” to the variable name (without the “$”).
_cURL_data_fn ( “variablename”)
This was successful and eliminated the 400 error. I’m curious about why the first attempt (adding the @ prefix) failed.