So the request body has a defined structure that inherits from PyDantic's BaseModel class. The data is inputted in JSON format. I've actually tested my code using fastAPI's user interface on the '.../docs' page--and it works fine. But how does this data get inputted by a user?
For example, let's say I have code like this
class SqlQuery(BaseModel):
column_to_select: str
@app.post("/query")
async def my_query(sql_query: SqlQuery):
# code to connect to the database goes here
execute_my_query_function(f"SELECT {sql_query.column_to_select} FROM mydatabase.mytable;")
Can I set this up where the end-user selects a column from a drop down, and that gets sent as JSON to my API? Because obviously we don't build apps where the end-user has to manually enter JSON. I'm trying to conceptualize how this would work in a real built-out application.