[Python] "There was an error parsing the body" error on requesting endpoint in FastAPI

Discussão em 'Python' iniciado por Stack, Abril 13, 2025.

  1. Stack

    Stack Membro Participativo

    I have implemented a endpoint in FastAPI and I am testing it from Postman. But whenever I send request I get this error "There was an error parsing the body", while searching for the error I found a solution somewhere that I need to have python-multipart installed, this package is already installed but I am still facing this error. Following is my code:

    @router.put('/user')
    def update_user(user_data: dict):
    from crain.uma import update_user
    user_id = user_data['id']
    update_user(user_id, user_data)
    return {"message": "DONE"}



    The endpoint except a dict like this:

    user_data = {
    "username":"admin",
    "id":"2d06aa3b-c25a-4499-948a-86341ac4adc5",
    "email":null,
    "firstName":"admin",
    "lastName":"admin",
    "createdTimestamp":1638268009973
    },


    [​IMG] [​IMG]

    Continue reading...

Compartilhe esta Página