Querying view Using the REST API fail


#1

hello, I try to use REST API to access view by entering following url:
http://bucketname:password@localhost:8091/bucketname/_design/designdocname/_view/viewname?key=“xyz”

the response is “Not found”

question here:

  1. why in the example below , we use port 8092 instead of 8091 which is port of couchbase server, i assume we should be use port for server not bucket
    http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-querying-rest-api.html

  2. if it’s SASL password-protected bucket but password is empty, should i use
    http://bucketname:@localhost:8092/bucketname/_design/designdocname/_view/viewname?key=“xyz”

3.can I use character ‘@’ in password.

4."Not found " here means cannot find bucket or cannot find view? I can access admin portal via:
http://localhost:8091

thanks in advance!


#2

1.The views are build in couchDB. So to access them you have to do a rest call to port 8092.
you can curl http://localhost:8092
It should return a hello greeting and tell you its an couchDB instance.

2,3,4
Can use any of the SDK’s to access couchbase? They have lots of great built in tools to access views.


#3

thanks!
I tried localhost:8092, no greet message show up. in fact, cannot connect to localhost:8092, but port 8092 is open.

I have not tried SDK yet, but if it’s an API via http request , i should be able to see response in web browsers?

thanks again!


#4

problem solved. need to add portal 8092 to iptables.


#5

Hello,

Just to be sure I am pointing to the right documentation page, you can see the list of port that you need to open to work with Couchbase here:
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-network-ports.html

You are correct, once you have open the port you can access/execute the query from your browser.

As Househippo mentioned, you can use the SDK API to query the views, for example in Java:
http://www.couchbase.com/docs/couchbase-sdk-java-1.1/api-reference-view.html

Let us know which programming language you are using and I will point your to a code snippet.

Regards
Tug
@tgrall