window下 curl post jsondata指令 无效的解决

Another Alternative for the command line that is easier than fighting with quotation marks is to put the json into a file, and use the @ prefix of curl parameters, e.g. with the following in json.txt:

{ "syncheader" : {
    "servertimesync" : "20131126121749",
    "deviceid" : "testDevice"
  }
}

then in my case I issue:

curl localhost:9000/sync -H "Content-type:application/json" -X POST -d @json.txt
Keeps the json more readable too.

猜你喜欢

转载自blog.csdn.net/xuyouyu/article/details/80868236