-
Notifications
You must be signed in to change notification settings - Fork 73
API Functionality
Thomas Pollet edited this page Mar 8, 2026
·
5 revisions
- Applies to: Flask and FastAPI
- Best examples:
README.md,examples/demo_relationship.py - Related pages: Relationships and Includes, Filtering, Sorting, Pagination, and Sparse Fieldsets, Content Types and Errors
For each exposed SQLAlchemy model, SAFRS creates:
- a collection endpoint
- an instance endpoint
- relationship endpoints
- OpenAPI / Swagger documentation for the generated operations
Typical resource behavior includes:
GET /CollectionPOST /CollectionGET /Collection/{id}PATCH /Collection/{id}DELETE /Collection/{id}
Actual allowed methods can be narrowed with Model.http_methods.
Relationships get their own endpoints. SAFRS distinguishes:
- to-one relationships
- to-many relationships
Relationship mutation methods depend on the relationship type and whether the parent model allows writes. See Relationships and Includes.
Collection and relationship reads commonly use:
includefilterfilter[attribute]sortpage[...]fields[TYPE]exclude
These are documented in more detail on the dedicated pages:
Common responses include:
-
200for successful reads and updates -
201for creates -
400for invalid requests and validation failures -
404for missing resources -
409for relationship or constraint conflicts -
415for unsupported media types -
422for request-shape validation in the FastAPI adapter
Error responses are documented in Content Types and Errors.
- Home
- Installation
- Quickstart (Flask)
- Quickstart (FastAPI)
- JSON:API Basics
- Relationships and Includes
- Filtering
- Sorting, Pagination, and Sparse Fieldsets
- Content Types and Errors
- Bulk Requests
- RPC / Custom Methods
- Customization
- Security and Access Control
- Stateless Endpoints / JABase
- Performance
- Examples
- Existing Databases (Legacy)
- PostGIS / GeoAlchemy2
- Docker / Deployment
- Troubleshooting
- Reference: SAFRSBase
- Reference: SAFRSBase Customization