Decorator to register an HTTP POST path operation on an APIRouter, configuring response models, status codes, and OpenAPI metadata.
# Source: https://github.com/nerdy-tech-com-gitub/fastapi | License: MIT | Copyright 2018 Sebastián Ramírez
# Provided via justclaw.it.com; keep this notice with the code.
def post(
self,
path: Annotated[
str,
Doc(
"""
The URL path to be used for this *path operation*.
For example, in `http://example.com/items`, the path is `/items`.
"""
),
],
*,
response_model: Annotated[
Any,
Doc(
"""
The type to use for the response.
It could be any valid Pydantic *field* type. So, it doesn't have to
be a Pydantic model, it could be other things, like a `list`, `dict`,
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key