Reference
Complete reference documentation for NpgsqlRest.
Annotations Reference
Comment annotations control how PostgreSQL functions are exposed as HTTP endpoints. Add annotations to function comments to configure routing, authentication, caching, and more.
HTTP & Routing
- HTTP - Expose function as HTTP endpoint
- PATH - Set custom endpoint path
- ENABLED - Enable endpoint for specific tags
- DISABLED - Disable endpoint for specific tags
- TAGS - Filter annotations by tags
Authorization
- AUTHORIZE - Require authentication
- ALLOW_ANONYMOUS - Allow unauthenticated access
- LOGIN - Mark as sign-in endpoint
- LOGOUT - Mark as sign-out endpoint
Basic Authentication
- BASIC_AUTH - Enable HTTP Basic Authentication
- BASIC_AUTH_REALM - Set authentication realm
- BASIC_AUTH_COMMAND - Set validation function
Request Configuration
- REQUEST_PARAM_TYPE - Query string vs body parameters
- REQUEST_HEADERS_MODE - Control header passing
- REQUEST_HEADERS_PARAMETER_NAME - Header parameter name
- BODY_PARAMETER_NAME - Body parameter name
- QUERY_STRING_NULL_HANDLING - NULL handling in query strings
Response Configuration
- Response Headers - Set custom response headers
- RESPONSE_NULL_HANDLING - NULL handling in responses
- RAW - Return raw text instead of JSON
- SEPARATOR - Column separator for raw output
- NEW_LINE - Row separator for raw output
- COLUMN_NAMES - Include column headers
Caching & Performance
- CACHED - Enable response caching
- CACHE_EXPIRES_IN - Set cache expiration
- BUFFER_ROWS - Row buffering count
- COMMAND_TIMEOUT - Query timeout
- RETRY_STRATEGY - Retry behavior
Server-Sent Events
- SSE - Enable Server-Sent Events
- SSE_EVENTS_LEVEL - Notice level for SSE
- SSE_EVENTS_SCOPE - SSE distribution scope
Upload & Policies
- UPLOAD - File upload handling
- ERROR_CODE_POLICY - Error handling policy
- RATE_LIMITER_POLICY - Rate limiting policy
Context & Security
- USER_CONTEXT - Enable user context
- USER_PARAMETERS - Add user parameters
- PARAMETER_HASH - Hash one parameter using another
- CONNECTION - Named database connection
- SECURITY_SENSITIVE - Obfuscate logs
- Custom Parameters - Custom key-value settings
Configuration Reference
Configuration options control the server behavior, database connections, security, and features. Settings can be provided via JSON files, environment variables, or command-line arguments.
Core Settings
- Top-Level Settings - Application identity, URLs, and config behavior
- NpgsqlRest Options - Core API generation settings
- Routine Options - PostgreSQL routine handling
- Connection Settings - Database connection strings
- Server & SSL - Kestrel web server and SSL/TLS configuration
Security
- Authentication - Authentication providers (JWT, Cookie, Basic)
- Authentication Options - Per-endpoint authentication configuration
- Antiforgery - CSRF protection settings
- Data Protection - Key storage and encryption settings
- CORS - Cross-Origin Resource Sharing configuration
Features
- CRUD Source - Automatic CRUD endpoint generation for tables
- OpenAPI - OpenAPI/Swagger documentation generation
- HTTP Files - HTTP test file generation
- Code Generation - Client code generation (TypeScript, etc.)
- Upload Options - File upload handling
Performance
- Response Compression - Gzip/Brotli compression settings
- Cache Options - Response caching configuration
- Rate Limiter - Rate limiting settings
- Command Retry - Database command retry policies
- Thread Pool - Thread pool configuration
Infrastructure
- Logging - Log levels and output configuration
- Static Files - Static file serving configuration
- Error Handling - Error response configuration