[Python] FastAPI post does not recognize my parameter

Discussão em 'Python' iniciado por Stack, Julho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I am usually using Tornado, and trying to migrate to FastAPI.

    Let's say, I have a very basic API as follows:

    @app.post("/add_data")
    async def add_data(data):
    return data


    When I am running the following Curl request: curl http://127.0.0.1:8000/add_data -d 'data=Hello'

    I am getting the following error:

    {"detail":[{"loc":["query","data"],"msg":"field required","type":"value_error.missing"}]}

    So I am sure I am missing something very basic, but I do not know what that might be.

    Continue reading...

Compartilhe esta Página