Running N1ql via REST API with bucket password?

If a bucket password is enabled, how can you use curl to run queries?

Using related examples on the net, I’ve been trying things like this:

curl -v $URL -d 'authType=sasl' \ 
   -d "saslPassword=$ADMIN_PASSWORD" \
   -d "statement=select count(*) from default"

Which does not work, with unrecognized parameter saslPassword.

I see a lot of examples of submitting HTTP basic auth, but what about password-only bucket protection?

Hi Moxious,

Just curious which version of Couchbase are you using?

If you’re keeping tab of the developer builds, you will notice that we will get rid of bucket passwords, in favor of users. Existing clusters and bucket passwords will be migrated to user accounts for back compat.

Don Pinto
Couchbase Server, Product Management

We’re using both 4.0 and 4.6, depending on location.

I submitted a support ticket and got this answered comprehensively; on this point the documentation is pretty unclear, I had read it three times and not gotten the right point.

For posterity, if anyone else visits this thread, with curl you can pass a -d “creds=[{“user”:“local:bucketname”,“pass”:“something”}]” and it will work – what the docs are unclear about in conjunction with other features is this point: a bucket password has no user, but the API expects you to submit as the user “local:bucketname”. If you search for a way to submit just a bucket password, you’ll never find it, and submitting HTTP basic auth with just the password won’t work either.

1 Like