flask-restful-swagger
flask-restful-swagger copied to clipboard
Can support "Get" command with request body ?
I am using flask-restful-swagger in my restful app, because my requirements have many parameters for different resources, so i want to put all of the params into request body of "Get" method (most of my app case is "Get" data).
i use curl to test my design, it works fine, just like: curl -i -H "Content-Type: application/json" -d "{"param1":"value1", "param2":"value2"}" -X GET localhost:5000/api/v1/resource
but when i use swagger UI to test, it looks fine, with body type parameters in UI, but it can't send the request body to my restful service (Receive None from request.json).
I know maybe the "query" paramType is suit for me, but i don't want to use query, because it will make a very long and complex URL.
The another option is "header" paramType, that could be a good choice, but current code (swagger 1.2 implementation) can't support header, right ?
Is there any possible method can meet my requirements or i need modify the swagger code ?
Get does not allow post parameters. So if you are using http GET you can not use a body.
I would have to recommend using POST, especially if you really want to send JSON, as that's the use case it's designed for.
I have used POST already, so it seems POST is the only choice
Once we are able to start implementing newer features like the "header" paramType, you'll have more options- thanks for flagging this as an issue.