Posts

Showing posts from March 15, 2019

Sending a POST request via curl has issues with double quotes

Image
0 So, in-order to send a POST request to gists (github), you can do something like this as seen in https://gist.github.com/caspyi... curl --user "user" -X POST --data '{"description":"Created via API","public":"true","files":{"file1.txt":{"content":"Demo"}}' https://api.github.com/gists But, in the above example, the file name and the content of the file are hard coded which is the part .. file1.txt":{"content":"Demo"} .. I am replacing the above part with my variable $file":{"content":"$content"} but initialize the variable, the json request must be enclosed in double quotes, which I did as curl --user "user" -X POST --data "{"description"...