db_pre_save
The db_pre_save callback — validate or modify objects on every POST /api/v1/db save, before they are written. Steps, filters, the object payload, the response rules, skip_plugins.
When it runs
Registering steps
callbacks:
db_pre_save:
steps:
- name: "set comment" # display name of the step
callback: set_comment # references the callbacks map below
filter:
type: objecttype
objecttypes:
- bilder
- name: "fill sequence number" # a step without filter runs for every save
callback: insert_sequence
callbacks:
set_comment:
exec:
service: "node"
commands:
- prog: "node"
stdin: { type: body }
stdout: { type: body }
args:
- { type: "value", value: "%_exec.pluginDir%/server/set_comment.js" }
insert_sequence:
plugin_user: # optional — act as a configured user
base_config: "user.api_user"
exec: { … }The request payload
Key
Description
The response
Skipping the callbacks
Example
See also
Last updated