As I find is often the case, getting a complex request to work is often very simple in POSTMAN and even a programming language found in .NET, but getting it to work in FileMaker can be quite time consuming.
Below is some JSON I want to pass to a POST Request using "--data $jsonData" The JSON is below, but regardless of what I try (hour after hour ... in FileMaker), I keep getting parse errors.
{"detail":"Failed to parse request body as JSON: unexpected EOF","status":400}
FileMaker set variable statement value below:
(I had to upload an image above so I didn't need to further refine my JSON so FMSOUP would show all the data.)
Can anyone see what I need to do to make FileMaker happy? I tried copying the working CURL from POSTMAN also and quoting that, but FileMaker won't work with that either.
I noticed if I add a second word to the "text" entry using your JSONSetElement example, I again get the could not parse error: {"detail":"Failed to parse request body as JSON: unexpected EOF","status":400}
If I just used a single word like "write", it works.
I tried different JSONSetElement options like "{}" and JSONString, etc., but none worked. Do you see what's missing now?
(Adding words works as before in POSTMAN CURL and Python.)
If you happened to be including a Content-Length header in the specified "cURL options" of the Insert From URL script step, then modifying the content size without updating the value specified by such a header could play out as you are seeing, especially if the actual content size exceeds what the header is indicating.
Please feel free to post a screenshot of the FileMaker script steps and the supporting calculations. Having more eyes on it could help.
The problem turned out to be that I didn't use the "@" in the '-d' portion of CURL options. I've never needed the "@" but I am happy to say that I learned something new and useful going forward.