python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
https://flask-restx.readthedocs.io/en/latest/
Other
2.14k stars 333 forks source link

Unable to send data as form-data #546

Open shukranjs opened 1 year ago

shukranjs commented 1 year ago

I want to send data in formData in swagger but it returns None. However, it displays that it is multipart/form-data but returns None

thefunkinator commented 1 year ago

wondering if you can share the code. Meanwhile try as per the README.md or something like,

@api.doc("create_todo")
@api.expect(todo)
@api.marshal_with(todo, code=201)
def post(self):
    """Create a new task"""
    return DAO.create(api.payload), 201

as both seem to send data as form in swagger

Keep posted how that goes. :-)

shukranjs commented 1 year ago

How to upload file using this structrue?

On Fri, Jul 7, 2023, 07:39 :-) @.***> wrote:

wondering if you can share the code. Meanwhile try as per the README.md https://github.com/chipndell/flask-restx#quick-start or something like,

@api.doc("create_todo") @api.expect(todo) @api.marshal_with(todo, code=201) def post(self): """Create a new task""" return DAO.create(api.payload), 201

as both seem to send data as form in swagger

Keep posted how that goes. :-)

— Reply to this email directly, view it on GitHub https://github.com/python-restx/flask-restx/issues/546#issuecomment-1624621510, or unsubscribe https://github.com/notifications/unsubscribe-auth/APO5GPRCD5MZVCEJTV22WPDXO6AHDANCNFSM6AAAAAAY36TH6M . You are receiving this because you authored the thread.Message ID: @.***>

thefunkinator commented 1 year ago

Here is Link to Doc for that.