Build a GET Endpoint in FastAPI: Query Admins with Wildcards and Authorization
Автор: The Beast Coder
Загружено: 2025-09-27
Просмотров: 12
Implement a production‑style GET endpoint in FastAPI to list admin users with flexible filters and proper authorization. The video walks through designing a read API that returns a list of admins, supports optional filters for ID, name, email, and phone, and defaults to wildcard matching when parameters aren’t provided. It demonstrates building SQL queries with LIKE wildcards for partial matches, handling the UUID ID path correctly, converting UUIDs to strings for JSON serialization, and returning clean JSON with 200 OK. It also covers enforcing admin‑only access via a current user check, structured error handling with 401 unauthorized and 500 internal errors, and a live Postman demo showing no‑filter listing and parameterized searches.
What you’ll learn:
1. Designing a GET endpoint that returns a list of admins (response model as a list)
2. Adding optional filters: ID (exact), name/email/phone (LIKE wildcards)
3. Using SQL wildcards (%) for flexible search and iterating query results
4. Converting UUIDs to strings for valid JSON responses
5. Privilege checks for admin‑only access and clear status codes (200/401/500)
6. Testing queries and parameters end‑to‑end in Postman
Chapters:
00:00 - Intro
00:26 - Read Admin API Explaination
02:26 - Code Explanation
07:20 - Demo
Tech stack:
FastAPI, Python, SQLAlchemy, UUID, JWT Bearer, Postman, ERP backend
Example requests:
GET /api/admins
GET /api/admins?email=abc
GET /api/admins?id=UUID
If this helped, like and subscribe.
For freelance work,
Fill THE FORM: https://docs.google.com/forms/d/e/1FA...
#webdevelopment #webdeveloper #fullstackdeveloper #erp #project #fastapi #postman #oauth #security #api #rolebasedaccess #jwt #authorization #docker #BearerToken #crud #FastAPI #UserManagement #CRUD #Admin #JWT #Authorization #Python #SQLAlchemy #API #BackendDevelopment #Security #Postman #SHA256 #ERP #Uvicorn #filtering #backenddevelopment #backend
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: