Eventing REST API

The Eventing REST API, available by default at port 8096, provides the methods available to work with Couchbase Eventing Functions.
The Eventing REST API is a Beta feature intended for development purposes only, do not use them in production; no Enterprise Support is provided for Beta features.
Table 1. Eventing Functions API
HTTP Method URI Path Description

POST

/api/v1/functions/[function_name]

Create a single Function. The Function name in the body must match that on the URL. Function definition includes current settings.

POST

/api/v1/functions/

Creates multiple Functions. Function names must be unique. When multiple Functions have the same name, an error is reported.

POST

/api/v1/import/

Imports multiple Functions. Function names must be unique. When multiple Functions have the same name, an error is reported. Note if any Function’s langauge_compatibility field is missing the value will be set to 6.0.0 (unlike the /api/v1/functions above which will set the value to the highest version supported by the server).

GET

/api/v1/functions

View a list of Functions. Provides a list of Functions available in the cluster. The list includes both the deployed and the undeployed Functions.

DELETE

/api/v1/functions/[function_name]

Deletes a specific Functions from the cluster.

DELETE

/api/v1/functions

Deletes multiple Functions from the cluster.

POST

/api/v1/functions/[function_name]/settings

Edit Function settings. During an edit, settings provided are merged. Unspecified attributes retain their prior values.

POST

/api/v1/config

Modify global configuration. During an edit, settings provided are merged. Unspecified attributes retain their prior values. The response indicates whether the Eventing service must be restarted for the new changes to take effect.

GET

/api/v1/functions/[function_name]/settings

Retruns the information for one function Functions in the cluster.

Sample API:

curl
http://Administrator@192.168.1.5:8096/api/v1/functions/[sample_name]/settings

POST

/api/v1/functions/[function_name]/settings

Deploys a Function. A deploy CURL example is provided for reference.

Sample API:

curl -XPOST -d '{"deployment_status":true,"processing_status":true}'
http://Administrator@192.168.1.5:8096/api/v1/functions/[sample_name]/settings

POST

/api/v1/functions/[function_name]/settings

Undeploys a Function. An undeploy CURL example is provided for reference.

Sample API:

curl -XPOST -d '{"deployment_status":false,"processing_status":false}'
http://Administrator@192.168.1.5:8096/api/v1/functions/[sample_name]/settings

POST

/api/v1/functions/[function_name]/settings

Updates an undeployed a Function with the provided setting. Do not update settings for a deployed or paused function. Note you must always specify deployment_status (deplyed/undeployed) and processing_status (paused/not-paused) when using this REST endpoint to opdate any option(s).

Sample API (alter worker_count):

curl -XPOST -d '{"deployment_status":false,"processing_status":false,"worker_count":6}'
http://Administrator@192.168.1.5:8096/api/v1/functions/[sample_name]/settings

POST

/api/v1/functions/[function_name]/settings

Updates an undeployed a Function with the provided settings. Do not update settings for a deployed or paused function. Note you must always specify deployment_status (deplyed/undeployed) and processing_status (paused/not-paused) when using this REST endpoint to opdate any option(s).

Sample API (alter app_log_max_files and app_log_max_files):

curl -XPOST -d '{"deployment_status":false,"processing_status":false,"app_log_max_files":5,"app_log_max_size":10485760}'
http://Administrator@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
Table 2. Eventing Statistics API
HTTP Method URI Path Description

GET

/api/v1/stats?type=full

Retrive all statistics for the node. This will return the full statistics set inclusive of events processing, events remaining, execution, failure, latency, worker PIDs and sequence processed.

Note, omitting the parameter type=full will exclude dcp_event_backlog_per_vb, doc_timer_debug_stats, latency_stats, plasma_stats and seqs_processed from the response.

GET

/getExecutionStats?name=[function_name]

Retrive only execution statistics. This will return the the subset of statistics for the node.

GET

/getLatencyStats?name=[function_name]

Retrive only latency statistics. This will return the the subset of statistics for the node.

GET

/getFailureStats?name=[function_name]

Retrive only falure statistics. This will return the the subset of statistics for the node.