aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rwxr-xr-xweb/webserver.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/web/webserver.scm b/web/webserver.scm
index 17f5716..a60f477 100755
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -29,6 +29,7 @@
(web gn-uri)
(gn db sparql)
(gn data species)
+ (gn data group)
(web sxml)
(web view doc))
@@ -51,6 +52,14 @@
(,(mk-url "datasets")."Get a list of datasets")))))
+(define (get-id-data id)
+ "Get data based on identifier id. If it is a taxon return the taxon data,
+otherwise search for set/group data"
+ (let ([taxoninfo (get-expanded-taxon-data id)])
+ (if taxoninfo
+ taxoninfo
+ (cdr (get-group-data id)))))
+
;; ---- REST API web server handler
(define (not-found2 request)
@@ -104,7 +113,8 @@
(let ([names (get-species-shortnames (get-expanded-species))])
(match (string->list id)
[(name ... #\. #\m #\e #\t #\a #\. #\j #\s #\o #\n) (render-json (get-expanded-taxon-meta (list->string name)))]
- [(name ... #\. #\j #\s #\o #\n) (render-json (get-expanded-taxon-data (list->string name)))]
+ [(name ... #\. #\j #\s #\o #\n) (render-json
+ (get-id-data (list->string name)))]
[rest (render-json "NOP")])))
(_ (not-found (request-uri request)))
))