Eventing REST API

      +
      The Eventing REST API, available by default at port 8096, provides the methods available to work with and manipulate Couchbase Eventing Functions.
      Changes to the Eventing Function definition files made outside of this REST API or the interactive UI are only supported for version 7.0 (and above) if the Eventing schemas located in https://github.com/couchbase/eventing/tree/master/parser are adhered to.

      As of version 7.1 Eventing now supports full Eventing Role-Based Access Control (RBAC).

      If the sample REST API shows two forms:

      • The first format is for privileged Eventing functions with a "Function Scope" of *.*; these functions can only be made or managed by users with the "Full Admin", "Eventing Full Admin" role. In addition this is the default "Function Scope" for all functions after an upgrade from a prior version. The creditionals for these examples will be "Administrator:password".

      • The second format uses RBAC and you must pass the parameters bucket=[fs_bucket]&scope=[fs_scope] to specify the bucket and the scope of the "Function Scope" to the REST call. In addition, due to the use or & and ? characters, you will need to quote your REST call on the command line. The creditionals for these examples will be "anyAuthedUser:password" (although "Administrator:password" can also use this form).

      If the sample REST API shows just a single format, then the REST API call does not require the parameters bucket=[fs_bucket]&scope=[fs_scope] and the action is fully determined by the username and password credentials passed to the REST call.

      Table 1. Eventing Functions API (basic activation/deactivation)
      HTTP Method URI Path Description

      POST

      /api/v1/functions/[sample_name]/deploy

      Deploys an undeployed Function. Starting with version 6.5.0, this is the preferred invocation. A deploy CURL example is provided for reference.

      Sample API:

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/deploy
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/deploy?bucket=[fs_bucket]&scope=[fs_scope]'

      POST

      /api/v1/functions/[sample_name]/undeploy

      Undeploys a Function. Starting with version 6.5.0, this is the preferred invocation. An undeploy CURL example is provided for reference.

      Sample API:

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/undeploy
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/undeploy?bucket=[fs_bucket]&scope=[fs_scope]'

      POST

      /api/v1/functions/[sample_name]/pause

      Pauses a Function and creates a DCP checkpoint such that on a subsequent resume no mutations will be lost. Starting with version 6.5.0, this is the preferred invocation. A pause CURL example is provided for reference.

      Sample API:

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/pause
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/pause?bucket=[fs_bucket]&scope=[fs_scope]'

      POST

      /api/v1/functions/[sample_name]/resume

      Resumes a paused function from its paused DCP checkpoint. Starting with version 6.5.0, this is the preferred invocation. A resume CURL example is provided for reference.

      Sample API:

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/resume
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/resume?bucket=[fs_bucket]&scope=[fs_scope]'
      Table 2. Eventing Functions API (advanced)
      HTTP Method URI Path Description

      POST

      /api/v1/functions/[function_name]

      Import or create a single Function. The Function name in the body must match that on the URL. Function definition includes current settings. The POST data or POST data file must be a single JSON object or an array containing a single JSON object

      Sample API (from file):

      curl -XPOST  -d @./[sample_name].json http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]
      curl -XPOST  -d @./[sample_name].json 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]?bucket=[fs_bucket]&scope=[fs_scope]'

      POST

      /api/v1/functions/

      Imports or creates multiple Functions. Function names must be unique. When multiple Functions have the same name, an error is reported. The POST data or POST data file must be either a single JSON object or an array containing a one or more JSON objects

      Sample API (from file):

      curl -XPOST  -d @./[array_of_functions].json http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions

      POST

      /api/v1/import/

      Imports multiple Functions. Function names must be unique. When multiple Functions have the same name, an error is reported. The POST data or POST data file must be either a single JSON object or an array containing a one or more JSON objects Note if any Function’s language_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).

      Sample API (from file):

      curl -XPOST  -d @./[array_of_functions].json http://anyAuthedUser:password@192.168.1.5:8096/api/v1/import

      GET

      /api/v1/functions/[sample_name]

      View a definition of a Function. Provides a listing of a complete Function definition available in the cluster. The Function could be in any state: deployed, undeployed, or paused. If saved to a file the function definition can be imported into the cluster or a different cluster. However any changes to the function definition made to the file outside the UI are discouraged.

      Sample API (to standard out):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]?bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (to file):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name] -o [sample_name].json
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]?bucket=[fs_bucket]&scope=[fs_scope]' -o [sample_name].json

      GET

      /api/v1/functions

      View definitions of all Functions. Provides an array of definitions of all Functions available in the cluster. The Functions could be in any state: deployed, undeployed, or paused. If saved to a file the function definitions can be imported into the cluster or a different cluster. However any changes to the function definition made to the file outside the UI are discouraged.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (to standard out):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions

      Sample API (to file):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions -o array_of_functions.json

      GET

      /api/v1/export

      This is a convenience method to export all function definitions. Exported functions are always set to undeployed state at the time of export, regardless of the state in the cluster at time of export. If saved to a file the function definitions can be imputed into the cluster or a different cluster. However any changes to the function definition made to the file outside the UI are discouraged.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (to standard out):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/export

      Sample API (to file):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/export -o array_of_functions.json

      DELETE

      /api/v1/functions/[function_name]

      Deletes a specific Function from the cluster. WARNING: Use this API with caution as it is irreversible.

      Sample API:

      curl -XDELETE http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]
      curl -XDELETE 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]?bucket=[fs_bucket]&scope=[fs_scope]'

      DELETE

      /api/v1/functions

      Deletes multiple Functions (as in all Functions) from the cluster. WARNING: Use this API with caution as it is irreversible.

      If this API is run as a non-Administrator the deleted set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API:

      curl -XDELETE http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions

      GET

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

      Export or return the full definition for one Eventing Function in the cluster. The definition can be subsequently imported. However any changes to the function definition made to the file outside the UI are discouraged.

      Sample API (to standard out):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (to file):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings -o [sample_name].json
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]' -o [sample_name].json

      POST

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

      Updates an undeployed or paused function with the provided setting. Note settings can only be altered when the function is paused or undeployed, attempting to adjust a deployed function will result in an error. During an edit, settings provided are merged. Unspecified attributes retain their prior values. Note that you must always specify deployment_status (deployed/undeployed) and processing_status (paused/not-paused) when using this REST endpoint to update any option or set of options.

      The current values of deployment_status and processing_status can be queried via api/v1/status or api/v1/status/[sample_name]

      By adjusting deployment_status and processing_status this command can also deploy or resume a function, however it cannot pause or undeploy a function.

      Sample API (alter worker_count):

      curl -XPOST -d '{"deployment_status":false,"processing_status":false,"worker_count":6}' http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XPOST -d '{"deployment_status":false,"processing_status":false,"worker_count":6}' 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (alter app_log_max_files and app_log_max_size) this function is currently undeployed:

      curl -XPOST -d '{"deployment_status":false,"processing_status":false,"app_log_max_files":5,"app_log_max_size":10485760}' http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XPOST -d '{"deployment_status":false,"processing_status":false,"app_log_max_files":5,"app_log_max_size":10485760}' 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (alter timer_context_size) this function is currently paused:

      curl -XPOST -d '{"deployment_status":true,"processing_status":false,"timer_context_size":2048}' http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XPOST -d '{"deployment_status":true,"processing_status":false,"timer_context_size":2048}' 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (alter worker_count AND resume) this function is currently paused:

      curl -XPOST -d '{"deployment_status":true,"processing_status":true,"worker_count":8}' http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XPOST -d '{"deployment_status":true,"processing_status":true,"worker_count":8}' 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'

      GET

      /api/v1/functions/[function_name]/config

      Export or return the configuration of the source keyspace and the eventing storage (metadata) keyspace for one Eventing Function in the cluster. The definition can be subsequently imported. However any changes to the function definition made to the file outside the UI are discouraged.

      Sample API (to standard out):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config?bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (to file):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config -o [sample_name].json
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config?bucket=[fs_bucket]&scope=[fs_scope]' -o [sample_name].json

      POST

      /api/v1/functions/[function_name]/config

      Import the configuration and alter the source keyspace and the eventing storage (metadata) keyspace for one Eventing Function in the cluster. You can only change these values if a function is in the undeployed state and the two keyspaces exist.

      Sample API (alter source and eventing storage keyspaces):

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config -d '{ "source_bucket": "bulk", "cust01": "orders", "source_collection": "customer01", "metadata_bucket": "rr100", "metadata_scope": "eventing", "metadata_collection": "metadata" }'
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config?bucket=[fs_bucket]&scope=[fs_scope]' -d '{ "source_bucket": "bulk", "cust01": "orders", "source_collection": "customer01", "metadata_bucket": "rr100", "metadata_scope": "eventing", "metadata_collection": "metadata" }'

      Sample API (alter source and eventing storage keyspaces from a file):

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config -d @./[sample_name].json
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/config?bucket=[fs_bucket]&scope=[fs_scope]' -d @./[sample_name].json

      GET

      /api/v1/functions/[function_name]/appcode

      Export only the JavaScript code for one Eventing Function in the cluster. Note the JavaScript is not escaped (unlike /api/v1/functions/[function_name]) and the code is runnable in other environments. The JavaScript code can be subsequently imported. However any changes to the function definition made to the file outside the UI are discouraged.

      Sample API (to standard out):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/appcode
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/appcode?bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (to file):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/appcode -o [sample_name].json
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/appcode?bucket=[fs_bucket]&scope=[fs_scope]' -o [sample_name].json

      POST

      /api/v1/functions/[function_name]/appcode

      Import only the JavaScript code for one Eventing Function in the cluster. Note the JavaScript supplied is not escaped (unlike /api/v1/functions/[function_name]) and could come from other environments. It is highly recommended that you use the flag --data-binary or --upload-file when importing your JavaScript "appcode" fragments to avoid potential encoding issues due to string escaping.

      Sample API (import and replace JavaScript):

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/appcode --data-binary 'function OnUpdate(doc, meta) { log("id",meta.id); }'
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/appcode?bucket=[fs_bucket]&scope=[fs_scope]' --data-binary 'function OnUpdate(doc, meta) { log("id",meta.id); }'

      Sample API (import and replace JavaScript from a file, do not use -d):

      curl -XPOST http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/import --data-binary @./[sample_name].json
      curl -XPOST 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/import?bucket=[fs_bucket]&scope=[fs_scope]' --data-binary @./[sample_name].json

      or

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/import --upload-file ./[sample_name].json
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/import?bucket=[fs_bucket]&scope=[fs_scope]' --upload-file ./[sample_name].json
      Table 3. Eventing Status API (advanced)
      HTTP Method URI Path Description

      GET

      /api/v1/status

      Returns a list (array) of all Eventing Functions showing their corresponding composite_status. A Function’s status can have one of the following values - undeployed, deploying, deployed, undeploying, paused, and 'pausing. Note, there is no value of resuming when resuming a paused Eventing Function the composite_status will return deploying until it reaches the deployed state.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (status):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/status

      GET

      /api/v1/status/[sample_name]

      Returns a specific Eventing Functions showing its corresponding composite_status. It can have one of the following values - undeployed, deploying, deployed, undeploying, paused, and 'pausing. Note, there is no value of resuming when resuming a paused Eventing Function the composite_status will return deploying until it reaches the deployed state.

      Sample API (status):

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/status/[sample_name]
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/status/[sample_name]?bucket=[fs_bucket]&scope=[fs_scope]'
      Table 4. Eventing Log API (advanced)
      HTTP Method URI Path Description

      GET

      /getAppLog?name=[sample_name]

      Returns the most recent application log messages for a specific Eventing Function.

      This API by default accesses a single Eventing node but can access all Eventing nodes by setting the optional parameter aggregate=true.

      By default the amount of logging information returned is approximately 40960 bytes unless you specify the optional size parameter size=# where # is in bytes. Note when specifying the size parameter and fetching from more than one Eventing node only size/#nodes bytes are returned from each node.

      Sample API (fetch recent Application log info from one Eventing node):

      curl -XGET http://Administrator:password@192.168.1.5:8096/getAppLog?name=[sample_name]
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/getAppLog?name=[sample_name]&bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (fetch recent Application log info from all Eventing nodes):

      curl -XGET http://Administrator:password@192.168.1.5:8096/getAppLog?name=[sample_name]&aggregate=true
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/getAppLog?name=[sample_name]&aggregate=true&bucket=[fs_bucket]&scope=[fs_scope]'

      Sample API (fetch recent Application log info from all Eventing nodes but limited to 2048 bytes):

      curl -XGET http://Administrator:password@192.168.1.5:8096/getAppLog?name=[sample_name]&aggregate=true&size=2048
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/getAppLog?name=[sample_name]&aggregate=true&size=2048&bucket=[fs_bucket]&scope=[fs_scope]'
      Table 5. Eventing List API (advanced)
      HTTP Method URI Path Description

      GET

      /api/v1/list/functions

      Returns a list (array) of the names of all Eventing Functions in the cluster. The returned list can also be filtered by the following: deployed status true or false (in this case paused is considered deployed), source_bucket filter by the bucket with the listen to keyspace, and function_type notsbm or sbm (the later if the functions that modifies its own listen to keyspace).

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (list):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/list/functions

      GET

      /api/v1/list/functions/query?deployed=true

      Returns a list (array) of the names of all deployed (or paused) Eventing Functions in the cluster. Note, if we had specified deployed=false we would get all undeployed functions.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (status):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/list/functions/query?deployed=true

      GET

      /api/v1/list/functions/query?source_bucket=[bucket_name]

      Returns a list (array) of the names of Eventing Functions in the cluster that have a source keyspace under a particular bucket.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (status):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/list/functions/query?source_bucket=[bucket_name]

      GET

      /api/v1/list/functions/query?function_type=sbm

      Returns a list (array) of the names of Eventing Functions in the cluster that modify their own a source keyspace.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (status):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/list/functions/query?function_type=sbm

      GET

      /api/v1/list/functions/query?function_type=notsbm

      Returns a list (array) of the names of Eventing Functions in the cluster that do not modify their own a source keyspace.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      Sample API (status):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/list/functions/query?function_type=notsbm
      Table 6. Eventing Global Config API (advanced)
      HTTP Method URI Path Description

      GET

      /api/v1/config

      List global configuration. The response shows all global Eventing settings. There are currently just two settings: enable_debugger (default value of false) and ram_quota (default value of 256 MB). Both of these settings can also be adjusted via the UI.

      Sample API:

      curl -XGET http://Administrator:password@192.168.1.5:8096/api/v1/config

      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.

      Sample API (alter ram_quota):

      curl -XPOST -d '{"ram_quota": 512}' http://Administrator:password@192.168.1.5:8096/api/v1/config

      Sample API (alter enable_debugger):

      curl -XPOST -d '{"enable_debugger": true}' http://Administrator:password@192.168.1.5:8096/api/v1/config

      Sample API (allow interbucket recursion):

      Note, setting the value of "allow_interbucket_recursion" to true is highly discouraged unless you have an advanced use case and follow strict non-production coding and verification. This will disable the safety checks that prevent running basic infinite recursive Eventing Functions

      curl -X POST -u Administrator:password http://192.168.1.5:8091/_p/event/api/v1/config -d '{"allow_interbucket_recursion":true}'

      Sample API (disallow interbucket recursion):

      This is the default setting of which applies some sanity checks to disable running basic infinite recursive Eventing Functions.

      curl -X POST -u Administrator:password http://192.168.1.5:8091/_p/event/api/v1/config -d '{"allow_interbucket_recursion":false}'
      Table 7. Eventing Statistics API
      HTTP Method URI Path Description

      GET

      /api/v1/stats?type=full

      Retrieve 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.

      If this API is run as a non-Administrator the return set will be filtered via RBAC to just the "Function Scopes" the user has access too.

      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.

      Sample API (basic):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/stats

      Sample API (full):

      curl -XGET http://anyAuthedUser:password@192.168.1.5:8096/api/v1/stats?type=full

      GET

      /getExecutionStats?name=[function_name]

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

      Sample API:

      curl -XGET http://Administrator:password@192.168.1.5:8096/getExecutionStats?name=[function_name]
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/getExecutionStats?name=[function_name]&bucket=[fs_bucket]&scope=[fs_scope]'

      GET

      /getLatencyStats?name=[function_name]

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

      Sample API:

      curl -XGET http://Administrator:password@192.168.1.5:8096/getLatencyStats?name=[function_name]
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/getLatencyStats?name=[function_name]&bucket=[fs_bucket]&scope=[fs_scope]'

      GET

      /getFailureStats?name=[function_name]

      Retrieve only failure statistics. This will return the subset of statistics for the node.

      Sample API:

      curl -XGET http://Administrator:password@192.168.1.5:8096/getFailureStats?name=[function_name]
      curl -XGET 'http://anyAuthedUser:password@192.168.1.5:8096/getFailureStats?name=[function_name]&bucket=[fs_bucket]&scope=[fs_scope]'
      Table 8. Eventing Functions API (deprecated activation/deactivation)
      HTTP Method URI Path Description

      POST

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

      Deploys an undeployed Function or resumes a paused function from its paused DCP checkpoint. Deprecated, see (basic activation/deactivation) for preferred invocation. A deploy/resume CURL example is provided for reference.

      Sample API:

      curl -XPOST -d '{"deployment_status":true,"processing_status":true}' http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XPOST -d '{"deployment_status":true,"processing_status":true}' 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'

      POST

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

      Undeploys a Function. Deprecated, see (basic activation/deactivation) for preferred invocation. An undeploy CURL example is provided for reference.

      Sample API:

      curl -XPOST -d '{"deployment_status":false,"processing_status":false}' http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XPOST -d '{"deployment_status":false,"processing_status":false}' 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'

      POST

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

      Pauses a Function and creates a DCP checkpoint such that on a subsequent resume no mutations will be lost. Deprecated, see (basic activation/deactivation) for preferred invocation. A pause CURL example is provided for reference.

      Sample API:

      curl -XPOST -d '{"deployment_status":true,"processing_status":false}' http://Administrator:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings
      curl -XPOST -d '{"deployment_status":true,"processing_status":false}' 'http://anyAuthedUser:password@192.168.1.5:8096/api/v1/functions/[sample_name]/settings?bucket=[fs_bucket]&scope=[fs_scope]'