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

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

RBAC

getScope

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

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