I'm trying to build a simple API using Flask, in which I now want to read some POSTed JSON. I do the POST with the Postman Chrome extension, and the JSON I POST is simply {"text":"hello world"}
. I try to read the JSON using the following method:
@app.route('/api/add_message/', methods=['GET', 'POST'])
def add_message(uuid):
content = request.json
print(content)
return uuid
On the browser it correctly returns the UUID I put in the GET, but on the console, it just prints out None
(where I expect it to print out the {"text":"hello world"}
. Does anybody know how I can get the posted JSON from within the Flask method?