What are the required parameters in POST body for adding an eventing function to Couchbase?
I am referencing this api call in documentation.
https://docs.couchbase.com/server/current/eventing/eventing-api.html# - POST /api/v1/functions/[function_name]
Would be nice to have an example for every eventing api call in the docs.
This the error I am getting from the eventing node:
“description”: “Invalid configuration”,
“info”: “Function name should not be empty”
Thanks for your feedback. I’ve created task DOC-7809 and we will add samples for each REST API endpoint.
Regarding contents, we are indeed in the process of specifying this precisely using a JSON schema, but this will ship only in 7.0 of the product (and so it’s not of immediate help to you). Please see MB-41236 - the schema in 7.0 can be seen in these files:
Schema for handler
Schema for bindings of handler
Schema for settings of handler
Schema for a list of handlers
However, as 7.0 is not yet released, in older versions of the product, my suggestion would be to create a small handler from the Couchbase UI and read the object out using GET /api/v1/functions/fn_name then modify the resulting object and write it back using POST to the same location. This way, all necessary fields will be prefilled.
Finally, the function name appearing on the URL of POST to /api/v1/functions/fn_name, and the function name appearing in the body of the POST message must match, failing which you’d get the error message seen.
If you encounter any problems, don’t hesitate to ping us here on forums.
Thanks @Siri for your reply.
I can confirm this works for Couchbase 6.6:
Read the object out using GET /api/v1/functions/fn_name then modify the resulting object and write it back using POST to the same location. This way, all necessary fields will be prefilled.