From 4ab2280c7282944997a7d68414761399e5955e89 Mon Sep 17 00:00:00 2001 From: leonoverweel Date: Sat, 1 Apr 2017 20:30:43 +0200 Subject: Allow GET, POST, PUT and DELETE for API calls --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index a8048312..50ded468 100644 --- a/main.py +++ b/main.py @@ -102,10 +102,11 @@ def sign_in(): return jsonify(**data) -@FLASK_CORE_APP.route('/api//') +@FLASK_CORE_APP.route('/api//', methods = ['GET', 'POST', 'PUT', 'DELETE']) def api_call(version, endpoint_path): """Call an API endpoint directly over HTTP""" + # Get path and parameters (path, path_parameters) = path_parser.parse(version, endpoint_path) query_parameters = request.args.to_dict() @@ -114,7 +115,8 @@ def api_call(version, endpoint_path): query_parameters[param] = int(query_parameters[param]) except: pass - + + # Create and call request message = { 'id': 0, 'method': request.method, -- cgit v1.2.3