CURL CouchDB的复制命令 - 无效JSON

问题描述 投票:4回答:4

我跑在袅袅以下行试图安装CouchDB的复制:

curl -X POST -d '{"source":"http://user:[email protected]:5984/main","target":"main"}' -H 'Content-Type: application/json' http://user:[email protected]/_replicate

它使返回以下错误:

{"error":"bad_request","reason":"invalid UTF-8 JSON"}

至于我可以告诉JSON似乎有效。有任何想法吗?

我还使用PowerShell的为好。

json powershell curl couchdb replication
4个回答
7
投票

这事发生很多次对我也是如此。 PowerShell的解析器(谁知道为什么)消除在JSON报价。

因此,将其发送到卷曲状“{出处:http://用户:[email protected]:5984 /主,目标:主要}”你需要调用它是这样的:

curl -X POST -d '{"""source""":"""http://user:[email protected]:5984/main""","""target""":"""main"""}' -H 'Content-Type: application/json' http://user:[email protected]/_replicate

看看http://pscx.codeplex.com/模块。发现这样的问题,当EchoArgs可能的帮助。


2
投票

望着CouchDB的维基我发现this这可能是解决您的问题非常有用。基本上,在Windows下你需要转义特殊字符或写JSON的文件,并使用来自卷边CLI。


0
投票

我已经与卷曲和问题PowerShell的面前 - 我的决心是从一个批处理文件(输出放入PowerShell的变量)调用它......认为这可能涉及到的参数传递给卷曲被误解的方式 - 我从来没有到它的底部,因为这工作...

也许这可以帮助http://huddledmasses.org/the-problem-with-calling-legacy-or-native-apps-from-powershell/

© www.soinside.com 2019 - 2024. All rights reserved.