LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Couchdb replicate (https://www.linuxquestions.org/questions/linux-newbie-8/couchdb-replicate-4175583232/)

iFunction 06-28-2016 03:09 AM

Couchdb replicate
 
Hi there,

I'm afraid I am having a difficult time with json syntax, as the tutorial I am reading has some errors.

So I am now trying to duplicate a database using cURL, and the syntax I have for this is:
Code:

curl -vX PUT http://127.0.0.1:5984/albums-replica
curl -vX POST htp://127.0.0.1:5984/_replicate -d '{"source":"albums","target":"albums-replica"}'

I the following error:
Code:

{"error":"bad_content_type","reason":"Content-Type must be application/json"}
What have I missed or got wrong here, I am trying to follow this tutorial http://guide.couchdb.org/editions/1/en/api.html but it's not very easy trying to decipher syntax you have never seen before.

Any help would be much appreciated.

Kind regards
iFunc

iFunction 06-28-2016 03:20 AM

My appologies,

I have suddenly chanced upon the answer, the syntax needs the ' -H Content-type: application/json' in the command and it should look as follows:
Code:

curl -H 'Content-Type: application/json' -X POST http://127.0.0.1:5984/_replicate -d '{"source":"albums","target":"albums-replica"}'
Kind regards
iFunk


All times are GMT -5. The time now is 04:45 AM.