REST put new design doc : get 406 Not Acceptable

Hi,

I’m using CouchBase Lite on Mac and iOS.
I’m trying, for tests purposes, to send a REST request to another intense of my application over my local network, in order to do peer to peer sync.
I tied both from Objective C and from a webView with jQuery (.ajax).

Most requests works, like basic GET. But i tried a PUT of a new design doc as described here :
http://developer.couchbase.com/mobile/develop/references/couchbase-lite/rest-api/design-document/put---db--_design--design-doc-/index.html

The DB is not read only and with no authentication.

I alway receive a 406 - Not Acceptable

I tried to change de header of the requests (content-type, accept) with no success.

If you have any idea of where this error could comes from i will appreciate !

Thanks a lot

rodolphe

That’s not how sync works. Use the CBLReplication class to sync.

Thanks for the reply.

I fact, i need to retrieve informations from the peer before the sync (in order to choose witch doc to sync, depending on an ID that i cannot guess).

For exemple i want to retrieve all documents of kind “project” and choose which projects to sync.

Can you show the exact request you send, including the full URL and headers?

The 406 Not Acceptable response code is sent if the request has an Accept: header, and the listener isn’t able to return the MIME type specified in that header. There’s not much point to having an Accept: header in a PUT request, so try taking it out.

I again, so you right, removing all the “accept” in the header do the trick. It works using Objective C, the jQuery AJAX seems to alway send Accept event after removing it. Anyway thanks a lot.