I'm trying to understand how to pass data via POST request method in Jupyter notebook kernel gateway and make a validation of the parameters.
I have already made some tests with GET method and It works as expected:
import json
# GET /get
req = json.loads(REQUEST)
args = req['args']
if 'name' not in args:
print(json.dumps({'name': None}))
else:
name = args['name'][0]
print(json.dumps({'name': name}))
So, if I got to http://127.0.0.1:8888/get?name=John I get the desired output of the GET request in json format.
But what if I want (after the previous GET validation) also to make a POST request passing a raw body like this and make the correct validation in order to output the value parameters only in case they are filled or not empty/null?
{"parameter_1":"5",
"parameter_2":"33",
"parameter_3":"120"
}
Thanks in advance for the suggestions.