🔜 👈 👥 ✔️ 👀 ❔ ⚙️ Path
& Query
, ➡️ 👀 🌅 🏧 ⚙️ 📨 💪 📄.
🥇, Path
, Query
& 📨 💪 🔢 📄 ➡ & FastAPI 🔜 💭 ⚫️❔.
& 👆 💪 📣 💪 🔢 📦, ⚒ 🔢 None
:
//// tab | 🐍 3️⃣.6️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
////
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
////
/// note
👀 👈, 👉 💼, item
👈 🔜 ✊ ⚪️➡️ 💪 📦. ⚫️ ✔️ None
🔢 💲.
///
⏮️ 🖼, ➡ 🛠️ 🔜 ⌛ 🎻 💪 ⏮️ 🔢 Item
, 💖:
{
"name": "Foo",
"description": "The pretender",
"price": 42.0,
"tax": 3.2
}
✋️ 👆 💪 📣 💗 💪 🔢, ✅ item
& user
:
//// tab | 🐍 3️⃣.6️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
////
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
////
👉 💼, FastAPI 🔜 👀 👈 📤 🌅 🌘 1️⃣ 💪 🔢 🔢 (2️⃣ 🔢 👈 Pydantic 🏷).
, ⚫️ 🔜
{
"item": {
"name": "Foo",
"description": "The pretender",
"price": 42.0,
"tax": 3.2
},
"user": {
"username": "dave",
"full_name": "Dave Grohl"
}
}
/// note
👀 👈 ✋️ item
📣 🎏 🌌 ⏭, ⚫️ 🔜 ⌛ 🔘 💪 ⏮️ 🔑 item
.
///
FastAPI 🔜 🏧 🛠️ ⚪️➡️ 📨, 👈 🔢 item
📨 ⚫️ 🎯 🎚 & 🎏 user
.
⚫️ 🔜 🎭 🔬 ⚗ 💽, & 🔜 📄 ⚫️ 💖 👈 🗄 🔗 & 🏧 🩺.
🎏 🌌 📤 Query
& Path
🔬 ➕ 💽 🔢 & ➡ 🔢, FastAPI 🚚 🌓 Body
.
🖼, ↔ ⏮️ 🏷, 👆 💪 💭 👈 👆 💚 ✔️ ➕1️⃣ 🔑 importance
🎏 💪, 🥈 item
& user
.
🚥 👆 📣 ⚫️, ↩️ ⚫️ ⭐ 💲, FastAPI 🔜 🤔 👈 ⚫️ 🔢 🔢.
✋️ 👆 💪 💡 FastAPI 😥 ⚫️ ➕1️⃣ 💪 🔑 ⚙️ Body
:
//// tab | 🐍 3️⃣.6️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
////
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
////
👉 💼, FastAPI 🔜 ⌛ 💪 💖:
{
"item": {
"name": "Foo",
"description": "The pretender",
"price": 42.0,
"tax": 3.2
},
"user": {
"username": "dave",
"full_name": "Dave Grohl"
},
"importance": 5
}
🔄, ⚫️ 🔜 🗜 📊 🆎, ✔, 📄, ♒️.
, 🔢, ⭐ 💲 🔬 🔢 🔢, 👆 🚫 ✔️ 🎯 🚮 Query
, 👆 💪:
q: Union[str, None] = None
⚖️ 🐍 3️⃣.1️⃣0️⃣ & 🔛:
q: str | None = None
🖼:
//// tab | 🐍 3️⃣.6️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
////
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
////
/// info
Body
✔️ 🌐 🎏 ➕ 🔬 & 🗃 🔢 Query
,Path
& 🎏 👆 🔜 👀 ⏪.
///
➡️ 💬 👆 🕴 ✔️ 👁 item
💪 🔢 ⚪️➡️ Pydantic 🏷 Item
.
🔢, FastAPI 🔜
✋️ 🚥 👆 💚 ⚫️ ⌛ 🎻 ⏮️ 🔑 item
& 🔘 ⚫️ 🏷 🎚, ⚫️ 🔨 🕐❔ 👆 📣 ➕ 💪 🔢, 👆 💪 ⚙️ 🎁 Body
🔢 embed
:
item: Item = Body(embed=True)
:
//// tab | 🐍 3️⃣.6️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
////
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
////
👉 💼 FastAPI 🔜 ⌛ 💪 💖:
{
"item": {
"name": "Foo",
"description": "The pretender",
"price": 42.0,
"tax": 3.2
}
}
↩️:
{
"name": "Foo",
"description": "The pretender",
"price": 42.0,
"tax": 3.2
}
👆 💪 🚮 💗 💪 🔢 👆 ➡ 🛠️ 🔢, ✋️ 📨 💪 🕴 ✔️ 👁 💪.
✋️ FastAPI 🔜 🍵 ⚫️, 🤝 👆 ☑ 📊 👆 🔢, & ✔ & 📄 ☑ 🔗 ➡ 🛠️.
👆 💪 📣 ⭐ 💲 📨 🍕 💪.
& 👆 💪 💡 FastAPI ⏯ 💪 🔑 🕐❔ 📤 🕴 👁 🔢 📣.