I am trying to pass parameters to cURL through the command line, this way:
curl -s -X POST -H "Content-Type: text/xml" -H "Cache-Control: no-cache" -d '<Data Token="someToken" Name='"$appName"' ID='"$someVar"' ParseAppID='"$someVar"' ParseRESTKey='"$someVar"' AndroidPackage='"$someVar"' Version="1"></Data>' 'https://prefix.something.com/somePath?InputType=Xml'
(This line is actually extracted from the Postman app).
I Googled this issue and found whole lot of solutions that did not work for me (links are to SO past questions...):
- I tried isolating the variables by ending the single quotes, this way:
'before...'"${someVar}"'...after...'
. Could not complete the request. - I tried passing the variables using a file (
-d @fileName)
. Failed to post. - I tried replacing the single quotes surrounding the
<Data>
tokens with double quotes - but the command apparently cannot accept such substitution.
The errors I get are either <Error></Error>
or The server encountered an error and could not complete your request.
Is there any chance that there exists some other solution? Has anyone encoutered such problem before?
I would be greatful for any help.