Managing Sample Buckets

Couchbase Server allows sample buckets to be installed. These contain data ready to be used for development and testing.

Description

Couchbase Server allows sample buckets to be installed, and then used for development and testing.

HTTP methods and URIs

The following methods and URIs respectively allow the names of the currently available sample buckets to be retrieved, and one or more to be installed on the cluster.

GET /sampleBuckets

POST /sampleBuckets/install

Curl Syntax

curl -X GET -u [username]:[password]
  http://[node-name-or-ip-address]:8091/sampleBuckets

curl -X POST -u [username]:[password]
  http://[node-name-or-ip-address]:8091/sampleBuckets/install
  -d '[ <bucketname>, <bucketname> ]'

The node-name-or-ip-address can be that of any node in the cluster. Each bucketname must be the name of an available sample bucket, specified as a string.

Responses

If the GET is successful, 200 OK is given, and an object describing available sample buckets is returned. If the POST is successful, 200 OK is given, and an empty message-list is returned. In either case, an incorrectly specified bucket-name or URI gives 404 Object Not Found; and failure to authenticate gives 401 Unauthorized.

Incorrectly using the POST to install one or more sample buckets that are already installed returns a list containing a message for each error; such as ["Sample bucket travel-sample is already loaded.","Sample bucket beer-sample is already loaded."].

Examples

The following example retrieves a list of the currently available sample buckets. Note that the output is piped to the jq program, to facilitate readability.

curl -X GET -u Administrator:password \
http://10.143.194.101:8091/sampleBuckets | jq

If successful, the call returns output such as the following:

[
  {
    "name": "beer-sample",
    "installed": false,
    "quotaNeeded": 104857600
  },
  {
    "name": "gamesim-sample",
    "installed": false,
    "quotaNeeded": 104857600
  },
  {
    "name": "travel-sample",
    "installed": false,
    "quotaNeeded": 104857600
  }
]

Each available bucket is listed, along with its current install-status (true or false). The memory quota required for each bucket, in Bytes, is also stated: note that this minimum must be available even though the actual sample bucket might not, with its default content, require it all.

The following example installs the travel-sample and beer-sample sample buckets:

curl -X POST -u Administrator:password \
http://10.143.194.101:8091/sampleBuckets/install \
-d '["travel-sample", "beer-sample"]'

If successful, the call returns an empty list.

See Also

Information on deleting buckets is provided in Deleting Buckets.

Information on installing sample buckets with the CLI is provided in cbdocloader.

Information on installing sample buckets with Couchbase Web Console is provided in Sample Buckets.