I am new to Flask. How can I fetch POST request body sent in XML format (mimetype="application/xml") through Postman as a dictionary in Flask API?
curl --location --request POST 'http://127.0.0.1:5000/test/' \
--header 'Content-Type: application/xml' \
--data-raw '<?xml version="1.0" encoding="UTF-8" ?>
<root>
<name>Sam</name>
<age>22</age>
</root>'
Is there any method to do so, like we do in case of JSON using:
content = flask.request.get_json()
Or is it like that we can only send the POST request body in JSON format?
I have tried xmltodict but I am not able to fetch the XML in Flask through flask.request
content = xmltodict.parse(request.{what??})
Any resources regarding the same will be appreciated.