Setting usernames and passwords

HTTP method and URI

Usernames and passwords can be set at any time, however, it is typically the last step when adding a node into a new cluster. Clients generally send a new request for cluster information based on this response.

POST /settings/web

Syntax

Raw HTTP request syntax:

POST /settings/web HTTP/1.1
Host: [localhost]:8091
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Authorization: Basic YWRtaW46YWRtaW4=
Content-Length: xx
username=[admin]&password=[password]&port=8091

Curl request syntax:

curl -u [admin]:[password] -d username=[new_admin] \
-d password=[new_password] \
-d port=8091 \
http://[localhost]:8091/settings/web

Example

Raw HTTP request example:

POST /settings/web HTTP/1.1
Host: 127.0.0.1:8091
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Authorization: Basic YWRtaW46YWRtaW4=
Content-Length: xx
username=Administrator&password=letmein&port=8091

Curl request example:

curl -u admin:password -d username=Administrator \
-d password=letmein \
-d port=8091 \
http://127.0.0.1:8091/settings/web

Response

If the parameters are valid, the corresponding HTTP response data indicates the new base URI.

HTTP/1.1 200 OK
Content-Type: application/json
Server: Couchbase Server 2.0
Pragma: no-cache
Date: Mon, 09 Aug 2010 18:50:00 GMT
Content-Type: application/json
Content-Length: 39
Cache-Control: no-cache no-store max-age=0
{"newBaseUri":"http://127.0.0.1:8091/"}
Note: The port number must be specified when username/password is updated.