CURL CouchDB复制命令 - 无效的JSON

DaR*_*DaR 4 powershell replication json curl couchdb

我在curl中运行以下行试图设置couchdb复制:

curl -X POST -d '{"source":"http://user:password@siteA.com:5984/main","target":"main"}' -H 'Content-Type: application/json' http://user:password@siteB.com/_replicate
Run Code Online (Sandbox Code Playgroud)

它不断返回以下错误:

{"error":"bad_request","reason":"invalid UTF-8 JSON"}
Run Code Online (Sandbox Code Playgroud)

据我所知,JSON似乎有效.有任何想法吗?

我也在使用Powershell.

ste*_*tej 7

它也经常发生在我身上.PowerShell解析器(谁知道原因)删除了json中的引号.

所以它发送它像'{来源:http:// user:password@siteA.com:5984/main,target:main}'你需要像这样调用它:

curl -X POST -d '{"""source""":"""http://user:password@siteA.com:5984/main""","""target""":"""main"""}' -H 'Content-Type: application/json' http://user:password@siteB.com/_replicate
Run Code Online (Sandbox Code Playgroud)

请查看http://pscx.codeplex.com/codel.EchoArgs在发现这些问题时可能有所帮助.