aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
authorBonfaceKilz2021-02-16 22:20:02 +0300
committerBonfaceKilz2021-02-16 22:20:02 +0300
commit474fca5b7e85c44879e5734cff09438ed92042c7 (patch)
tree50f015ca7fdfd1f1ff76bc7e3499d5edc2366ff3 /gn3/api
parent0a70905e5b16e372bea9fd3e13a16fbd9152a416 (diff)
downloadgenenetwork3-474fca5b7e85c44879e5734cff09438ed92042c7.tar.gz
Add new endpoint for uploading data
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/general.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/gn3/api/general.py b/gn3/api/general.py
new file mode 100644
index 0000000..d52d033
--- /dev/null
+++ b/gn3/api/general.py
@@ -0,0 +1,22 @@
+"""General API endpoints. Put endpoints that can't be grouped together nicely
+here."""
+from flask import Blueprint
+from flask import current_app
+from flask import jsonify
+from flask import request
+
+from gn3.file_utils import extract_uploaded_file
+
+
+general = Blueprint("general", __name__)
+
+
+@general.route("/metadata/upload")
+def upload_metadata():
+ """Extract uploaded file to gn3 temporary directory; and if successful return
+a TOKEN to the user
+
+ """
+ results = extract_uploaded_file(gzipped_file=request.files["file"],
+ target_dir=current_app.get("TMPDIR"))
+ return jsonify(results)