BODY_PARAMETER_NAME
Also known as
body_param_name (with or without @ prefix)
Specify which parameter receives the raw request body.
Syntax
code
@body_parameter_name <param-name>Examples
Custom Body Parameter
sql
sql
create function process_payload(_metadata json, _payload text)
returns json
language sql
begin atomic;
...;
end;
comment on function process_payload(json, text) is
'HTTP POST
@body_parameter_name _payload';Equivalent as a SQL file endpoint (sql/process-payload.sql):
sql
sql
/*
HTTP POST
@body_parameter_name payload
@param $1 metadata json
@param $2 payload text
*/
select process_payload($1, $2);JSON Body Parameter
sql
sql
create function handle_webhook(_body json)
returns void
language sql
begin atomic;
...;
end;
comment on function handle_webhook(json) is
'HTTP POST
@body_parameter_name _body';Behavior
- Directs the raw request body to the specified parameter
- Useful when you need access to the complete body content
- Parameter type should match expected content (text, json, bytea)
Related
- NpgsqlRest Options configuration - Configure default body parameter
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works
Related Annotations
- REQUEST_PARAM_TYPE - Control parameter source