-
First Check
Commit to Help
Example Code@router.get(
'/api/v1/details/userName={user_name}',
name="data:get-user-details",
tags=["USerManagement"],
status_code=status.HTTP_200_OK,
summary="Get userdetails from database table"
)
async def get_user_details(
userName: Optional[str] = None,
data_service: Depends = Depends(get_data_service)
):DescriptionHello, i have to create endpoint with the path variable and query parameters. is it possible to design single end point to achieve this ? Thanks& regards Operating SystemLinux Operating System DetailsNo response FastAPI Version0.75.1 Python Version3.8 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
|
Hi @aru88 , based on your endpoints: /api/v1/details I think you just need two Query parameters. Hope that helps! |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
@aru88 You cannot use default options in Path. A Path is needed. fastapi.params.py > 14 from source I recommend a separate endpoint. |
Beta Was this translation helpful? Give feedback.
-
|
You may be able to achieve what you want with a custom path converter from within Starlette. https://www.starlette.io/routing/ I am unsure though if that stuff can be exposed in fastapi or used, you will have to do more research or try it and see. |
Beta Was this translation helpful? Give feedback.
@aru88 You cannot use default options in Path. A Path is needed.
fastapi.params.py > 14 from source