Hi there, i’m new to N1QL. i have done one Application by using Couchbase Lite in iOS. Now i want to access my data on Admin Portal. so i want to create a Public Rest API by using N1QL queries.
I Read this tutorial. but im not able to execute following GET request on Postman.
Looks like a typo in the URL you are using. It should be http://myaddress:8093/query/service, not http://myaddress:8093//query, so the full thing would be
Hmm. Are you able to use the REST API with curl?
e.g.:
$ curl -v http://host:8093/query/service -d "statement=select * from default"
I’m not too familiar with how Postman displays error messages, but curl should shed some light on it. Are you sure the machine you’re on can reach the Couchbase Server node? How about if you just try to hit one of the other ports on the node, e.g:
$ curl -v http://localhost:8092
* Rebuilt URL to: http://localhost:8092/
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8092 (#0)
> GET / HTTP/1.1
> Host: localhost:8092
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: MochiWeb/1.0 (Any of you quaids got a smint?)
< Date: Mon, 02 May 2016 13:56:18 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 90
< Cache-Control: must-revalidate
<
{"couchdb":"Welcome","version":"2.1.1r-545-g29c7ee6","couchbase":"4.5.0-1308-enterprise"}
* Connection #0 to host localhost left intact
@JFlath sorry i didn’t try curl. but i tried to test curl operation for testing port. it was failed see below image For more details. How can i up 8092 port.
A possible reason that you get the above error with the Postman app is that your couchbase instance isn’t running, or you havent pointed it to the correct URL.
Try the following curl command (after replacing my host to your hostname or ip):
curl -v http://myhost:8093/query/service -d ‘statement=select 1’
As Isha said, you can also try connecting to 8091 or 8093 to check connectivity - I just happened to pick 8092 as an example. When you ran the curl command in the screenshot, were you on one of the Couchbase Server nodes? If not, you would need to use the hostname of one of them instead of localhost as in my example.
So in your case I that would be curl -v http://myappdemo.com:8092, or you could use the examples Isha mentioned, either’s good.
@JFlath Thanks, yes as Isha said, its working on Admin port. but not on query port. what should i do, for working on query port? is it possible to run on Public API.