I’m running the latest versions of CouchBase and N1QL (as of now Community 2.2.0-837-rel and Developer Preview 3 respectively) and I’m able to do queries using the cbq command, but I’d like to do them with curl.
I tried curl localhost:8093/query -d ‘select * from free’ -v
but I get a 500 error and a body of Missing required query string.
I looked at https://github.com/couchbaselabs/query/blob/master/shell/shell.go#L34 and from there I got that it should be a POST request to /query of the cbq-engine server, with the N1QL query string on the request body.
Then I started a nc server and pointed the cbq command to there, just to see what request it was making, and this is what I’m getting:
► nc -l 9090
POST /query HTTP/1.1
Host: localhost:9090
User-Agent: Go 1.1 package http
Content-Length: 37
Content-Type: text/plain
Accept-Encoding: gzip
select * from free where _oid = “pp”;
So what am I missing ? Do the User-Agent and Accept-Encoding make the difference ?
Update: Is it coming from here: https://github.com/couchbaselabs/tuqtng/blob/master/network/http/http_query.go#L36 ?