Issue
Would anyone be able to give me a tip on how to use this api with postman written with Flask in Python?
@app.route('/read', methods=['POST'])
def do_read():
try:
device_id = request.get_json().get('device_id')
object_id = request.get_json().get('object_id')
object_type = request.get_json().get('object_type')
prop = request.get_json().get('prop')
except:
err_msg = "Read request was missing a required parameter. Required: [device_id, object_id, object_type]"
logging.warning(err_msg + " Exception: " + str(sys.exc_info()))
return jsonify({"status_code": 500, "description": err_msg})
So if I am posting to route /read
in postman I am still getting a http code 500 returned. Any tips to try?
Solution
You are not sending a json but rather form data. This could be the potential issue.
Try selecting raw radio button and change to JSON in the dropdown and write the data as a json.
Answered By – PureVodka
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0