REST API List buckets
When using /pools/default/buckets to get a list of buckets, there is unexpected behavior that tripped me up a bit.
This behavior can be proven with just a browser.
If you have ONLY buckets WITH passwords, no authentication is required. Response is a list of all buckets Good.
If you have ONLY buckets WITHOUT passwords, authentication is required. Response is a list of all buckets. Good.
If you have a mixture of buckets WITH *and* WITHOUT passwords, you get a list of only non-passworded buckets if you have not previously entered credentials in the browser, and a list of all buckets if you have.
In .Net I am using HttpWebRequest, and specifying Credentials. But, I only get back a list of non-passworded buckets, not all buckets.
Because the web response doesn't do an authentication step, HttpWebRequest does not establish an authenticated connection. So there is no way to get a full list of buckets, even though I have the credentials needed!
If there are only passworded buckets, then authentication is performed and HttpWebRequest provides the list just fine.
Desired behavior from my point of view, is that if there are any passworded buckets, then authentication would be required, rather than getting back an incomplete list of buckets.
I understand others could see it differently, and want it the way it is.
Just want to throw out the request and see what others think.
I haven't tried it, but I suspect couchbase-cli.exe has the same problem, of not being able to list all buckets, even if credentials are supplied.
-ChssAddct
In the meantime, it works for me to have all my buckets be passworded. So, I'm OK. Just wanted to throw this info out to the public, since I got tripped up by it.
Not at all familar with .net api. So there's no way to ask it to provide basic auth?
There may be.
It clearly provides authentication when 'prompted' to by a 401 Unauthorized response, re-submitting the request using the Credentials I supply it.
I just didn't google to determine if there is a way. After determining the problem, I simply applied passwords to all buckets, and moved on to my next problem.
Even still, if there is a way, it may still be a problem with couchbase-cli.exe.
-ChssAddct
Re-submitting only after hitting 401 is kind of suboptimal. But we'll re-consider auth as well.
This sounds like an issue to me. I have filed a bug here.
http://www.couchbase.com/issues/browse/MB-4992
Thanks for letting us know.