Back to all posts
fastapi programming python

FastAPI Parameters

0 min read (38 words)

A quick note about how to pass parameters

@app.get("/ise/{mac_address}")
async def ise_search_mac_address(mac_address):
    return {"Search MAC": mac_address}
FastAPI endpoint example showing path parameter usage with MAC address parameter demonstration

Another example:

@app.get("/{mode}/ise")
async def ise_mode(mode):
    if mode == 'dev':
        return {'result': "Working with Dev ISE"}

    return {'result': "Working with Prod ISE"}
FastAPI development mode endpoint demonstration with conditional response based on mode parameter
Dmitry Golovach
About

Dmitry Golovach

Principal Network Engineer and AI enthusiast. Always learning, always building.

Share this post

All posts