aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPjotr Prins2020-07-20 11:49:21 +0100
committerPjotr Prins2020-07-20 11:49:21 +0100
commit0f9a652e08d429d8edcf12638d642003baa5d8ec (patch)
tree8cdba315d0d3750950bf12c59f2d51d74dcd2cc2 /test
parentf368b3e047d14055bc63899771c782ebbb8c6553 (diff)
downloadbh20-seq-resource-0f9a652e08d429d8edcf12638d642003baa5d8ec.tar.gz
bh20-seq-resource-0f9a652e08d429d8edcf12638d642003baa5d8ec.tar.lz
bh20-seq-resource-0f9a652e08d429d8edcf12638d642003baa5d8ec.zip
REST API
Diffstat (limited to 'test')
-rw-r--r--test/rest-api.org51
1 files changed, 34 insertions, 17 deletions
diff --git a/test/rest-api.org b/test/rest-api.org
index c797cf3..4a7b09b 100644
--- a/test/rest-api.org
+++ b/test/rest-api.org
@@ -1,40 +1,38 @@
* PubSeq REST API
Here we document the public REST API that comes with PubSeq. The tests
-are written and run in the amazing emacs [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html][org-babel]]. Execute a code
-block with C-c C-c. You may need to set
+run in the amazing emacs [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html][org-babel]]. See the bottom of this document
+for running the tests inside emacs.
-#+begin_src elisp
-(org-babel-do-load-languages
- 'org-babel-load-languages
- '((python . t)))
-(setq org-babel-python-command "python3")
-#+end_src
+** Introduction
-#+RESULTS:
-: python3
+We built a REST API for COVID-19 PubSeq. The API source code can be
+found in [[https://github.com/arvados/bh20-seq-resource/tree/master/bh20simplewebuploader/api.py][api.py]]. To see if the service is up try
-To skip confirmations you may also want to set
+: curl http://covid19.genenetwork.org/api/version
-: (setq org-confirm-babel-evaluate nil)
+#+begin_src js
+{
+ "service": "PubSeq",
+ "version": 0.1
+}
+#+end_src
-** Check the version
+The Python3 version is
#+begin_src python :session
import requests
-response = requests.get("http://localhost:5000/api/version")
+response = requests.get("http://covid19.genenetwork.org/api/version")
response_body = response.json()
assert response_body["service"] == "PubSeq", "PubSeq API not found"
-response_body
#+end_src
#+RESULTS:
-| service | : | PubSeq | version | : | 0.1 |
** Fetch EBI XML
#+begin_src python :session
-requests.get("http://localhost:5000/api/ebi/sample-MT32690.1.xml").text
+requests.get("http://covid19.genenetwork.org/api/ebi/sample-MT32690.1.xml").text
#+end_src
#+RESULTS:
@@ -91,3 +89,22 @@ requests.get("http://localhost:5000/api/ebi/sample-MT32690.1.xml").text
</SAMPLE>
</SAMPLE_SET>
#+end_example
+
+* Configure emacs to run tests
+
+Execute a code
+block with C-c C-c. You may need to set
+
+#+begin_src elisp
+(org-babel-do-load-languages
+ 'org-babel-load-languages
+ '((python . t)))
+(setq org-babel-python-command "python3")
+#+end_src
+
+#+RESULTS:
+: python3
+
+To skip confirmations you may also want to set
+
+: (setq org-confirm-babel-evaluate nil)