Is there any documentation anywhere on how to convert an invocation of curl
into the Mathematica equivalent (using for example URLExecute
or URLRead
with HTTPRequest
)?
The specific curl
code I am having trouble converting to a Mathematica equivalent is
curl -X POST --data 'Expected RESPONSE.' "https://postman-echo.com/post"
where I use the example API from this service. My attempt to convert this was
URLExecute[HTTPRequest["https://postman-echo.com/post",
<|Method -> "POST", "ContentType" -> "application/x-www-form-urlencoded",
"Body" -> ExportString[{"Expected RESPONSE." -> ""}, "JSON"]|>]]
but I did not get the results consistent with what is produced by curl
. What would be the right way to use Mathematica functions for this example? I know I can just use RunProcess
with curl
if need be, but I want to assume I cannot or will not be able to use curl
itself (e.g. on a Windows computer where I cannot install curl
).
Either answers to my general or specific inquiry would be appreciated.
curl
on my machine. Can you elaborate on what is inconsistent? $\endgroup$