I have a web service that expects some parameters. I want to pass one of these parameters (named "data") to curl via stdin. I tried
echo -n "some data" | curl -d x="foo" -d y="bar" -d data=@- "http://somewhere"
which doesn't work, as the value of data then is "@-" instead of "some data".
Is it possible to use the @ in curl to associate the input from stdin with a specific parameter?
edit: My goal is to chain multiples web services so the data I pass will be the output of another curl call.
You could also save your data in a variable and then use it like this:
Use
-d @-
E.g.:
Output:
Is this not possible?
Or
echo "some data"
can be another command or file input:$(<somefile)
.