Custom Parameters
Set custom key-value configuration for the endpoint.
Syntax
<key> = <value>Dynamic Parameter Values
Some parameters support dynamic values using the {param_name} format, where param_name references a function parameter. The value is resolved at runtime from the actual parameter value passed to the endpoint.
Example
create function upload_file(_path text, _file text)
returns void
language sql as $$
-- function body
$$;
comment on function upload_file(text, text) is '
file_system_path = {_path}
file_system_file = {_file}
';When called with {"_path": "/uploads/images", "_file": "photo.jpg"}, the file will be saved to /uploads/images/photo.jpg.
Built-in Parameters
The following parameters are recognized by NpgsqlRest and its handlers.
General Parameters
| Parameter | Description |
|---|---|
buffer_rows, buffer | Sets the buffered amount of rows before they are written to the response. |
columns, names, column_names | If true and endpoint is in raw mode, response will contain header names. |
connection, connection_name | Defines an alternative connection name that must exist in the ConnectionStrings dictionary. |
new_line, raw_new_line | Defines the separator between raw value rows when raw mode is enabled. |
raw, raw_mode, raw_results | Sets response to raw mode where HTTP response is written exactly as received from PostgreSQL. |
separator, raw_separator | Defines the separator between raw value columns when raw mode is enabled. |
Upload Handler Parameters
Shared Parameters
| Parameter | Description |
|---|---|
stop_after_first_success | When true, stops processing after the first successful upload handler. |
included_mime_types | Comma-separated list of MIME type patterns to include for upload processing. |
excluded_mime_types | Comma-separated list of MIME type patterns to exclude from upload processing. |
Large Object Upload Handler
| Parameter | Description |
|---|---|
buffer_size, large_object_buffer_size | Size of the buffer used for reading/writing large object data. |
check_text, large_object_check_text | When true, checks if the uploaded content is text format. |
check_image, large_object_check_image | When true, checks if the uploaded content is an image format. |
test_buffer_size, large_object_test_buffer_size | Size of the buffer used for testing file content type. |
non_printable_threshold, large_object_non_printable_threshold | Threshold for determining if content contains non-printable characters. |
oid, large_object_oid | PostgreSQL large object OID to use for storage. |
large_object_included_mime_types | MIME type patterns to include for large object upload processing. |
large_object_excluded_mime_types | MIME type patterns to exclude from large object upload processing. |
File System Upload Handler
| Parameter | Description |
|---|---|
buffer_size, file_system_buffer_size | Size of the buffer used for reading/writing file system data. |
check_text, file_system_check_text | When true, checks if the uploaded content is text format. |
check_image, file_system_check_image | When true, checks if the uploaded content is an image format. |
test_buffer_size, file_system_test_buffer_size | Size of the buffer used for testing file content type. |
non_printable_threshold, file_system_non_printable_threshold | Threshold for determining if content contains non-printable characters. |
path, file_system_path | File system path where uploaded files will be stored. |
file, file_system_file | Specific file name to use for the uploaded content. |
unique_name, file_system_unique_name | When true, generates unique file names to avoid conflicts. |
create_path, file_system_create_path | When true, creates the directory path if it doesn't exist. |
file_system_included_mime_types | MIME type patterns to include for file system upload processing. |
file_system_excluded_mime_types | MIME type patterns to exclude from file system upload processing. |
CSV Upload Handler
| Parameter | Description |
|---|---|
test_buffer_size, csv_test_buffer_size | Size of the buffer used for testing CSV content type. |
non_printable_threshold, csv_non_printable_threshold | Threshold for determining if content contains non-printable characters. |
check_format, csv_check_format | When true, validates the CSV format before processing. |
delimiters, csv_delimiters | Characters used as field delimiters in CSV files (e.g., comma, semicolon). |
has_fields_enclosed_in_quotes, csv_has_fields_enclosed_in_quotes | When true, expects CSV fields to be enclosed in quotes. |
set_white_space_to_null, csv_set_white_space_to_null | When true, converts whitespace-only fields to NULL values. |
row_command, csv_row_command | SQL command to execute for each CSV row during processing. |
csv_included_mime_types | MIME type patterns to include for CSV upload processing. |
csv_excluded_mime_types | MIME type patterns to exclude from CSV upload processing. |
Excel Upload Handler
| Parameter | Description |
|---|---|
sheet_name, excel_sheet_name | Name of the specific Excel worksheet to process. |
all_sheets, excel_all_sheets | When true, processes all worksheets in the Excel file. |
time_format, excel_time_format | Format string for parsing time values from Excel cells. |
date_format, excel_date_format | Format string for parsing date values from Excel cells. |
datetime_format, excel_datetime_format | Format string for parsing datetime values from Excel cells. |
row_is_json, excel_row_is_json | When true, treats each Excel row as JSON data. |
row_command, excel_row_command | SQL command to execute for each Excel row during processing. |
excel_included_mime_types | MIME type patterns to include for Excel upload processing. |
excel_excluded_mime_types | MIME type patterns to exclude from Excel upload processing. |
SSE (Server-Sent Events) Parameters
SSE Events Path
Additional path appended as a subpath to the main endpoint path for SSE events streaming. If the endpoint path is /path and this value is set to /info, the streaming path will be /path/info. Set to true to use the notice level name as the path.
| Parameter | Values |
|---|---|
sse, sse_path, sse_events_path | <path>, true, false |
SSE Events Level
Sets the PostgreSQL notice level for SSE events. Determines which PostgreSQL notice messages will be streamed to the client.
| Parameter | Values |
|---|---|
sse_level, sse_events_level | info, notice, warning |
SSE Events Scope
Scope that determines to whom events are streamed:
| Parameter | Values |
|---|---|
sse_scope, sse_events_scope | matching, authorize, all, authorize role1, role2, ... |
| Scope | Description |
|---|---|
matching | Sessions with matching security context of the endpoint initiator. |
authorize | Only authorized sessions receive messages. Optionally specify roles. |
all | All sessions regardless of security context receive messages. |
TypeScript Client Parameters
| Parameter | Description |
|---|---|
tsclient | Set to false, off, disabled, disable, or 0 to disable TypeScript client code generation for the endpoint. |
tsclient_events | Enable or disable SSE events parameter for endpoints with SSE events enabled. |
tsclient_parse_url | Enable or disable URL parsing in generated client. |
tsclient_parse_request | Enable or disable request parsing in generated client. |
tsclient_status_code | Enable or disable status code in the return value. |
tsclient_module | Sets different module name for the generated TypeScript client file. |
Related
- NpgsqlRest Options configuration - Configure default parameters
- Upload configuration - Configure upload handlers
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works