@GET — Aquilia Documentation
Comprehensive guide and documentation for @GET in the Aquilia framework. View API reference, examples, and implementation patterns.
Back to Decorators @GET The @GET decorator handles HTTP GET requests. It is the workhorse for retrieving resources and listing collections, with built-in support for filtering, searching, sorting, and pagination. Basic Usage Response: """List all users.""" users = await self.repo.all() return Response.json(users) @GET("/«id:int»") async def get_user(self, ctx: RequestCtx, id: int) -> Response: """Get a single user by ID.""" user = await self.repo.get(id) return Response.json(user)`} language="python" /> Advanced Filtering Aquilia's @GET decorator integrates directly with the FilterSet system. You can enable declarative filtering without writing any boilerplate query parsing logic. 1. Simple Field Filtering Use filterset_fields to allow exact matching on specific fields. 2. Custom FilterSets For complex logic (ranges, multiple values, related fields), define a FilterSet class. Search & Ordering Full-Text Search Enable the ?search= query parameter by defining searchable fields. Dynamic Ordering Allow clients to sort results using ?ordering=field (or -field for descending). Pagination Pagination is handled by the pagination_class argument. The framework provides standard implementations, but you can also supply your own. Complete API Reference Argument Type Description path str URL path pattern (e.g., /users/«id:int»). Defaults to method name if None. filterset_fields list[str] List of fields to enable simple exact-match filtering on. search_fields list[str] Fields to search against when the search query param is present. ordering_fields list[str] Fields allowed in the ordering query param. pagination_class Type[Pagination] Class to handle pagination logic (PageNumber, LimitOffset, Cursor). renderer_classes list[Type[Renderer]] Renderers to use for Content-Type negotiation. )
Go to Homepage