Windows: curl with json data on the command line
"I searched for solutions and found alternatives such as put json data in files, but I cannot use it for some reasons"
This should work, with hello.json
in temp. The @
is requried.
c:\temp>curl -v -X PUT \
--data "@hello.json" \
-H "Content-Type:application/json" \
http://localhost:8080/api/myresource
Windows's cmd
doesn't support strings with single quotes. Use "
and escape the inner ones with \"
.