Skip to content

Actions ​

Cbjs HTTP Client offers several functions to perform various retrieval or mutations on different services.

Cluster ​

initCluster ​

Use this to setup a new cluster. Useful for CI and deployment automation.
Don't forget to use setIndexerSettings if you use the query service.

ts

declare function 
initCluster
(
apiConfig
:
CouchbaseHttpApiConfig
,
initClusterParams
:
InitClusterParams
):
Promise
<void>;

setIndexerSettings ​

Configures the indexer of the query service.

ts
declare function 
setIndexerSettings
(
apiConfig
:
CouchbaseHttpApiConfig
,
settings
:
CouchbaseIndexerSettings
):
Promise
<void>;

getClusterRelease ​

Retrieves information about the cluster release.
Example : { version: '7.2.4', build: '1337', flavor: 'enterprise' }

ts
declare function 
getClusterRelease
(
apiConfig
:
CouchbaseHttpApiConfig
):
Promise
<
ClusterRelease
>;

getClusterRootCertificates ​

Retrieves the root certificates of the cluster. Useful to bootstrap some automation mechanism.

ts
declare function 
getClusterRootCertificates
(
apiConfig
:
CouchbaseHttpApiConfig
):
Promise
<
ApiCertificate
[]>;

versionSupportsFeatures ​

Checks if a particular release number supports a feature.

ts
declare function 
versionSupportsFeatures
(
version
: string,
...
features
:
ServerFeature
[]
): boolean; // Example const
isSupported
=
versionSupportsFeatures
(
'7.2.4',
ServerFeatures
.
ServerDurability
,
ServerFeatures
.
SubdocReadReplica
);

getPool ​

Retrieves information about the cluster pool.

ts
declare function 
getPool
(
params
:
Omit
<
CouchbaseHttpApiConfig
, 'poolNodes'>,
poolName
?: string
):
Promise
<
ApiPool
>;

getRebalanceProgress ​

Retrieves information about the cluster pool.

ts
declare function 
getRebalanceProgress
(
params
:
CouchbaseHttpApiConfig
,
poolName
?: string
):
Promise
<
ApiRebalanceProgress
>;

getNodeServices ​

Retrieves the ports published by each node, per service.
This is how you reach a service that doesn't run on the node you are connected to, or that doesn't listen on its standard port.

ts
declare function 
getNodeServices
(
apiConfig
:
Omit
<
CouchbaseHttpApiConfig
, 'poolNodes'>,
poolName
?: string
):
Promise
<
ApiNodeServices
>;

Use extractNodeServiceAddresses to turn that response into addresses. A node is reported through its alternateAddresses.external entry when it has one publishing that service, which on Capella is the only address resolvable from outside the deployment.

ts
declare function 
extractNodeServiceAddresses
(
nodeServices
:
ApiNodeServices
,
service
: string,
defaultHostname
: string
):
NodeServiceAddress
[];

getIndexServiceAddresses ​

Retrieves the address of the HTTP API of every node running the index service.

ts
declare function 
getIndexServiceAddresses
(
apiConfig
:
Omit
<
CouchbaseHttpApiConfig
, 'poolNodes'>,
poolName
?: string
):
Promise
<
NodeServiceAddress
[]>;

getIndexServiceStatus ​

Retrieves the status of every index of the cluster, as reported by the index service itself.
Prefer getQueryIndexStatus unless you need what only the index service reports : the number of centroids an IVF vector index has been trained with (numCentroids), the options it was created with (with) and whether it indexes a vector (isVectorIndex).

The node running the index service is looked up for you, and its API is reached on its own port.

ts
declare function 
getIndexServiceStatus
(
apiConfig
:
Omit
<
CouchbaseHttpApiConfig
, 'poolNodes'>,
poolName
?: string
):
Promise
<
ApiIndexServiceStatus
>;

WARNING

The index service API lives on its own port, 9102 / 19102, and not on the management port. On Capella, nodes do publish it, but reaching it depends on your network : the port must be allowed by your allow list, VPC peering or private endpoint. When no node publishes that API on the network you reached the cluster from, the call throws.

Analytics ​

Creates a links to feed your analytics dataverse.

ts
declare function 
createAnalyticsLink
(
apiConfig
:
CouchbaseHttpApiConfig
,
link
:
ApiAnalyticsLink
):
Promise
<void>;

Retrieves the existing analytics links. You can filter by dataverse using the scope option.

ts
declare function 
getAnalyticsLinks
(
apiConfig
:
CouchbaseHttpApiConfig
,
options
?:
GetAnalyticsLinksOptions
):
Promise
<
ApiAnalyticsLink
[]>;

getAnalyticsClusterStatus ​

Retrieves various information about the current status of the analytics cluster.

ts
declare function 
getAnalyticsClusterStatus
(
apiConfig
:
CouchbaseHttpApiConfig
):
Promise
<
AnalyticsClusterStatus
>;

Eventing ​

deployEventingFunction ​

Deploys an eventing function previously created.

ts
declare function 
deployEventingFunction
(
apiConfig
:
CouchbaseHttpApiConfig
,
name
: string,
scope
?:
EventingFunctionScope
):
Promise
<void>;

pauseEventingFunction ​

Pauses an eventing function previously deployed.

ts
declare function 
pauseEventingFunction
(
apiConfig
:
CouchbaseHttpApiConfig
,
name
: string,
scope
?:
EventingFunctionScope
):
Promise
<void>;

resumeEventingFunction ​

Resumes an eventing function previously paused.

ts
declare function 
resumeEventingFunction
(
apiConfig
:
CouchbaseHttpApiConfig
,
name
: string,
scope
?:
EventingFunctionScope
):
Promise
<void>;

undeployEventingFunction ​

Undeploys an eventing function previously deployed.

ts
declare function 
undeployEventingFunction
(
apiConfig
:
CouchbaseHttpApiConfig
,
name
: string,
scope
?:
EventingFunctionScope
):
Promise
<void>;

dropEventingFunction ​

Drops an eventing function previously created.

ts
declare function 
dropEventingFunction
(
apiConfig
:
CouchbaseHttpApiConfig
,
name
: string,
scope
?:
EventingFunctionScope
):
Promise
<void>;

getEventingFunctionStatus ​

Retrieves the current status of an eventing function.

ts
declare function 
getEventingFunctions
(
apiConfig
:
CouchbaseHttpApiConfig
,
):
Promise
<
ApiEventingFunctionStatus
>;

getEventingFunctions ​

Retrieves the existing eventing functions.

ts
declare function 
getEventingFunctions
(
apiConfig
:
CouchbaseHttpApiConfig
,
):
Promise
<
ApiEventingFunction
[]>;

KeyValue ​

getBucket ​

Retrieves the settings of a bucket.

ts
declare function 
getBucket
(
apiConfig
:
CouchbaseHttpApiConfig
,
bucketName
: string
):
Promise
<
ApiBucket
>;

getScope ​

Retrieves the scopes within a bucket.

ts
declare function 
getScopes
(
apiConfig
:
CouchbaseHttpApiConfig
,
bucketName
: string
):
Promise
<
ApiBucketScopes
>;

getCollections ​

Retrieves the collections within a scope.

ts
declare function 
getCollections
(
apiConfig
:
CouchbaseHttpApiConfig
,
bucketName
: string,
scopeName
: string
):
Promise
<
ApiCollection
[]>;

Query ​

executeStatement ​

Executes an arbitrary query.

ts
declare function 
executeStatement
<
Result
>(
params
:
CouchbaseHttpApiConfig
,
statement
: string
):
Promise
<
ApiQueryResponseBody
<
Result
>>;

getQueryBuckets ​

Retrieves the list of buckets visible from the query service.

ts
declare function 
getQueryBuckets
(
params
:
CouchbaseHttpApiConfig
):
Promise
<string[]>;

getQueryIndexes ​

Return the list of all indexes within the given scope.

ts
declare function 
getQueryIndexes
(
params
:
CouchbaseHttpApiConfig
,
options
?:
Partial
<
Keyspace
>
):
Promise
<
HttpClientQueryIndex
[]>;

getQueryIndexStatus ​

Return the status of the index, as reported by the cluster manager : its progress, the nodes it lives on, its partitions and its replicas.

ts
declare function 
getQueryIndexStatus
(
apiConfig
:
CouchbaseHttpApiConfig
,
indexName
: string,
keyspace
:
Keyspace
):
Promise
<
ApiQueryIndexStatus
>;

getQueryIndexStats ​

Return the stats of the index, given by the indexer.

ts
declare function 
getQueryIndexStats
(
params
:
CouchbaseHttpApiConfig
,
indexName
: string,
keyspace
:
Keyspace
):
Promise
<
HttpClientQueryIndexStats
>;

getQueryIndexRemainingMutations ​

Return the number of documents awaiting to be indexed.
The value is the sum of the queued (not sent to the indexer) and pending mutations (received by the indexer but not processed).

ts
declare function 
getQueryIndexRemainingMutations
(
params
:
CouchbaseHttpApiConfig
,
indexName
: string,
keyspace
:
Keyspace
):
Promise
<number>;

getQuerySearchIndexes ​

Retrieves the search indexes that are visible by the query service. Useful when using Flex Index : leveraging full-text search within a SQL++ query. You can filter by keyspace and by index name.

ts
declare function 
getQuerySearchIndexes
(
params
:
CouchbaseHttpApiConfig
,
options
?: {
bucket
?: string,
scope
?: string,
collection
?: string,
index
?: string;
} ):
Promise
<
HttpClientSearchIndex
[]>;

createQueryIndex ​

Create a query index.

ts
declare function 
createQueryIndex
(
params
:
CouchbaseHttpApiConfig
,
indexName
: string,
keyspace
:
Keyspace
,
config
: {
keys
: string[],
where
?: string,
numReplicas
?: number
},
options
?:
CreateQueryIndexOptions
):
Promise
<
CreateQueryIndexResponse
>;

updateQueryIndex ​

Update a query index.

ts
declare function 
updateQueryIndex
(
params
:
CouchbaseHttpApiConfig
,
indexName
: string,
keyspace
:
Keyspace
,
config
: {
action
: 'move' | 'replica_count' | 'drop_replica';
num_replica
?: number;
nodes
?: string[];
replicaId
?: string;
} ):
Promise
<[]>;

RBAC ​

whoami ​

Retrieves a user by its username. Can filter by domain using a third parameter.

ts
declare function 
whoami
(
apiConfig
:
CouchbaseHttpApiConfig
):
Promise
<
ApiWhoami
>;

getUser ​

Retrieves a user by its username. Can filter by domain using a third parameter.

ts
declare function 
getUser
(
apiConfig
:
CouchbaseHttpApiConfig
,
username
: string,
domain
?: string
):
Promise
<
ApiUser
>;

updateUserPassword ​

Update a user's password.

ts
declare function 
updateUserPassword
(
apiConfig
:
CouchbaseHttpApiConfig
,
newPassword
: string,
):
Promise
<void>;

getUsers ​

Retrieves all the existing users.

ts
declare function 
getUsers
(
apiConfig
:
CouchbaseHttpApiConfig
):
Promise
<
ApiUser
[]>;

getUserGroup ​

Retrieves a user group by its name.

ts
declare function 
getUserGroup
(
apiConfig
:
CouchbaseHttpApiConfig
,
name
: string
):
Promise
<
ApiUserGroup
>;

getUserGroups ​

Retrieves all the existing user groups.

ts
declare function 
getUserGroups
(
apiConfig
:
CouchbaseHttpApiConfig
):
Promise
<
ApiUserGroup
[]>;

getRoles ​

Retrieves all the existing roles.

ts
declare function 
getRoles
(
apiConfig
:
CouchbaseHttpApiConfig
):
Promise
<
ApiRole
[]>;

Search / FTS ​

getSearchIndex ​

Retrieves information about a search index.

ts
declare function 
getSearchIndex
(
params
:
CouchbaseHttpApiConfig
,
indexName
: string
):
Promise
<
ApiSearchGetIndex
>;

getSearchIndexes ​

Retrieves all the existing search indexes.

ts
declare function 
getSearchIndexes
(
params
:
CouchbaseHttpApiConfig
):
Promise
<
ApiSearchGetAllIndexes
>;

getSearchIndexStatistics ​

Retrieves the statistics related to a search index.

ts
declare function 
getSearchIndexStatistics
(
params
:
CouchbaseHttpApiConfig
,
indexName
: string
):
Promise
<
ApiSearchGetIndex
>;

getSearchIndexCount ​

Retrieves the number of documents indexed by a search index. Accepts either a global index name or a { bucket, scope, index } triple for a scoped index.

The underlying FTS count endpoint only answers with a 200 once every pindex of the index is hosted and available. While the pindexes are still being planned or built, it answers with pindex not available — the same error a real query would raise. A successful call is therefore a faithful probe of whether the index is actually queryable, which is exactly how waitForSearchIndex gates query visibility.

ts
declare function 
getSearchIndexCount
(
params
:
CouchbaseHttpApiConfig
,
index
: string | {
bucket
: string;
scope
: string;
index
: string }
):
Promise
<
SearchIndexCount
>;

Stats ​

getIndexerStatistics ​

Retrieves various statistics about the query indexer.

ts
declare function 
getIndexerStatistics
(
apiConfig
:
CouchbaseHttpApiConfig
,
skipEmpty
?: boolean
):
Promise
<
IndexerStatistics
['indexer']>;

getStatistics ​

Retrieves multiple statistics at once.

ts
declare function 
getStatistics
(
apiConfig
:
CouchbaseHttpApiConfig
,
stats
: [
StatisticDefinition
, ...
StatisticDefinition
[]]
):
Promise
<[
StatisticsResult
, ...
StatisticsResult
[]]>;

Views ​

getViewDesignDocuments ​

Retrieves the views existing within a bucket.

ts
declare function 
getViewDesignDocuments
(
params
:
CouchbaseHttpApiConfig
,
bucketName
: string):
Promise
<
ApiViewDesignDocuments
>;