Home > Blockchain >  Linux cURL to Windows cURL in bat file
Linux cURL to Windows cURL in bat file

Time:12-29

I have been trying for a few days to figure out how to convert a cURL command that works perfectly in the Linux terminal but just can't figure out how to format it correctly so that I can use it in a windows bat file. Any help would be highly appreciated.

The Linux cURL command that works perfectly in Linux:

curl -X PUT \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-type:application/json; charset=utf-8' \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/pushpublish/mapentries/ppsource \
-d'
{
   "serverName": "_defaultServer_",
   "sourceStreamName": "newStream",
   "entryName": "ppsource",
   "profile": "rtmp",
   "host": "localhost",
   "application": "testlive",
   "userName": "testUser",
   "password": "pass",
   "streamName": "myStream"
}'

How can I do the same in windows cmd?

CodePudding user response:

  • Change single quotes to double quotes
  • Change the line continuation character from \ to ^
  • Check the effective command with echo on

Or use a browser (using windows), open the developer mode (F12) and copy a network entry with copy as windows curl

CodePudding user response:

Use carret ^ as a line continuation symbol instead of backslash \, and doublequote all string instead of singlequoute. Include line termination to json at the end.

  • Related