Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

AJAX/FLASK/JS: How to POST existing array into endpoint

@app.route("/api/fileNames", methods=['POST', 'GET'])
def fileNameStorage():
if request.method == 'POST':
    data = {
    "id": request.json["id"],
    "song_name": request.json["song_name"],
    "time_duration": request.json["time_duration"]
}
    return data, 200
else:
    return "error", 400 # currently goes to 'return error'
 
PREVIOUS NEXT
Tagged: #How #POST #existing #array #endpoint
ADD COMMENT
Topic
Name
4+5 =