I was looking for the couchbase REST API's for insert/update a document in given bucket, but I couldn't find any. Does anybody knows if such API exist?
Only API i could find is for updating design document:
http://docs.couchbase.com/couchbase-manual-2.5/cb-rest-api/#design-documents-rest-api
It is not documented (thus, probably not supported), but you can do this using the same base URL as the couchbase bucket API (see table 4). The complete path is:
...hostname:8091/pools/default/buckets/{bucketname}/docs/{docid}
To confirm this, just go to your couchbase web console, and use your builtin browser developer tools to check all network queries, and hit save button. You can verify this is the actual REST endpoint that the couchbase web console hits when you open or save a document.
It uses basic HTTP auth. But, instead of bucket password it needs Admin credentials.
Important: You should not rely on this for high performance operations. Performance on number of gets and sets operations using this undocumented REST endpoint is way too slow compared to couchbase official SDK which is optimized protocol that does not carry the HTTP overhead.
There is no REST API for CRUD operations in Couchbase. If you must use REST, you'll pretty much have to use an external service as a proxy. You can probably use the Couchbase mobile sync gateway as a sort of CRUD service, or roll your own. You can find an example here: https://github.com/couchbaselabs/couchbase-rest-api-rails
Created a simple sample that shows CRUD on an existing bucket in Couchbase at:
http://blog.arungupta.me/crud-java-application-with-couchbase-java-ee-and-wildfly/
This is then exposed as a REST API.
REST API's for insert/update a document in given bucket
http://localhost:8092/bucket name/doucmnetId
application/json
{ insert your json data }
create a POST request to your couchbase you can create the document.
create a PUT request you can update your document in couchbase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With