mayur gavali
mayur gavali

Reputation: 49

Curl command to select and insert the data (document) into the Couchbase bucket using cmd

I am trying to just select the bucket from Couchbase, I am unable to do so As I am following the link below which does not contain adequate and basic information. And there after I want to insert the document into the bucket as well using simple curl command. I tried using material avaiable on google but it wont help me on that. Please help me out to make simple select and Insert query for same..Thank you in advance

curl -v http://localhost:8091/query/service -d 'statement=SELECT Emp Id FROM Employee WHERE META().id ="01"'

https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/curl.html

Bucket contains data as -

enter image description here

Upvotes: 0

Views: 1300

Answers (1)

vsr
vsr

Reputation: 7414

Checkout query service REST API (docs link: https://docs.couchbase.com/server/current/n1ql/n1ql-rest-api/index.html)

Also CURL must send request to query service port (8093), OR use couchbase SDKs

curl -v -u user:pass http://localhost:8093/query/service -d 'statement=SELECT `Emp Id` FROM Employee USE KEYS "Emp Id:01"'
curl -v -u user:pass http://localhost:8093/query/service -H "Content-Type: application/json" -d '{"statement":"SELECT `Emp Id` FROM Employee USE KEYS \"Emp Id:01\""}'

Upvotes: 1

Related Questions