CURL CouchDB Replication command - Invalid JSON CURL CouchDB Replication command - Invalid JSON curl curl

CURL CouchDB Replication command - Invalid JSON


It happend many times to me as well. PowerShell parser (who knows why) removes quotes in the json.

So it sends it to curl like '{source:http://user:password@siteA.com:5984/main,target:main}'You need to call it like this:

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

Look at http://pscx.codeplex.com/ module. EchoArgs might help when discovering such problems.


Looking at the CouchDB wiki I found this which could be useful to solve your issue.Basically under Windows you need to escape special characters or to write the JSON in a file and use that from the curl CLI.


I've had problems with curl and PowerShell before - my resolution was to call it from a batch file (the output put into a PowerShell variable)... thought it might be related to the way arguments were passed to curl being misinterpreted - I never got to the bottom of it as this worked...

maybe this could help http://huddledmasses.org/the-problem-with-calling-legacy-or-native-apps-from-powershell/