Whats the difference b/w Path and Query in FastAPI?

Path parameters are part of the URL path and are required.
Example: /get_patient_data/1
— here, 1 is a path parameter.

Query parameters come after the ? in the URL and are **optional **by default.
Example: /sorted_patient_list?sort_by=asc
— here, sort…


This content originally appeared on DEV Community and was authored by Sarvesh Kesharwani

Path parameters are part of the URL path and are required.
Example: /get_patient_data/1
— here, 1 is a path parameter.

Query parameters come after the ? in the URL and are **optional **by default.
Example: /sorted_patient_list?sort_by=asc
— here, sort_by=asc is a query parameter.


This content originally appeared on DEV Community and was authored by Sarvesh Kesharwani


Print Share Comment Cite Upload Translate Updates
APA

Sarvesh Kesharwani | Sciencx (2025-06-07T15:39:11+00:00) Whats the difference b/w Path and Query in FastAPI?. Retrieved from https://www.scien.cx/2025/06/07/whats-the-difference-b-w-path-and-query-in-fastapi/

MLA
" » Whats the difference b/w Path and Query in FastAPI?." Sarvesh Kesharwani | Sciencx - Saturday June 7, 2025, https://www.scien.cx/2025/06/07/whats-the-difference-b-w-path-and-query-in-fastapi/
HARVARD
Sarvesh Kesharwani | Sciencx Saturday June 7, 2025 » Whats the difference b/w Path and Query in FastAPI?., viewed ,<https://www.scien.cx/2025/06/07/whats-the-difference-b-w-path-and-query-in-fastapi/>
VANCOUVER
Sarvesh Kesharwani | Sciencx - » Whats the difference b/w Path and Query in FastAPI?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/06/07/whats-the-difference-b-w-path-and-query-in-fastapi/
CHICAGO
" » Whats the difference b/w Path and Query in FastAPI?." Sarvesh Kesharwani | Sciencx - Accessed . https://www.scien.cx/2025/06/07/whats-the-difference-b-w-path-and-query-in-fastapi/
IEEE
" » Whats the difference b/w Path and Query in FastAPI?." Sarvesh Kesharwani | Sciencx [Online]. Available: https://www.scien.cx/2025/06/07/whats-the-difference-b-w-path-and-query-in-fastapi/. [Accessed: ]
rf:citation
» Whats the difference b/w Path and Query in FastAPI? | Sarvesh Kesharwani | Sciencx | https://www.scien.cx/2025/06/07/whats-the-difference-b-w-path-and-query-in-fastapi/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.