Rest end point to post documents on 8093

Is there a Rest End Point that can be used to Post/PUT/Upsert Json documents to couchbase directly without using Couchbase SDK or Sync Gateway? The way we query off 8093 port for a read operation, is there something similar to write/upsert a json document into Couchbase using rest end point on 8093?

yes, N1QL REST API for INSERT / UPSET / UPDATE / DELETE
for example

curl -v http://127.0.0.1:8093/query/service -d 'statement=INSERT INTO `default` (KEY, VALUE) VALUES ( "TEST001",  {"type":"TEST","key1":"value1"}) RETURNING *;'
curl -v http://127.0.0.1:8093/query/service -d 'statement=UPSERT INTO `default` (KEY, VALUE) VALUES ("TEST001", { "type":"TEST","key1":"value1","newkey": "newvalue1"}) RETURNING * ;'
curl -v http://127.0.0.1:8093/query/service -d 'statement=UPDATE `default` USE KEYS ["TEST001"] SET key1 = "new value1" RETURNING *;'
curl -v http://127.0.0.1:8093/query/service -d 'statement=DELETE FROM `default` USE KEYS ["TEST001"] RETURNING *;'

1 Like

Thank you that worked!