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
>;

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
[]>;

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
>;

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
>;