Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
How to get query params in fast api from POST request

Client might send multiple query params like:

# method = POST 
http://api.com?x=foo&y=bar

I need to get all the query params and extract it as a string x=foo&y=bar from the POST request.

Is there a way to do this on fast api? I could not find it on their docs.

NOTE :

We are not sure of the names of the params before hand.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Depending how you want to use the data, you can either use request.query_params to retrieve a immutable dict with the parameters, or you can use request.url to get an object representing the actual URL. This object has a query property that you can use to get the raw string:

from fastapi import FastAPI, Request
import uvicorn

app = FastAPI()

@app.get('/')
def main(request: Request):
    return request.url.query

 
uvicorn.run(app)

This returns the given query string /?foo=123 as foo=123 from the API. There is no difference between a POST or GET request for this functionality.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda