aboutsummaryrefslogtreecommitdiff
path: root/api/alternative-API-structure.md
diff options
context:
space:
mode:
authorrupertoverall2023-06-28 05:48:50 +0200
committerGitHub2023-06-28 05:48:50 +0200
commita398dd9d2642a1732cd9b415150f211040af76d5 (patch)
tree42298119f375b5a7079ae01fee639465f052be09 /api/alternative-API-structure.md
parent4734eff0a9a517c84cb36d28abda2adb65ba3219 (diff)
downloadgn-docs-a398dd9d2642a1732cd9b415150f211040af76d5.tar.gz
Edit 'error catching' section
Diffstat (limited to 'api/alternative-API-structure.md')
-rw-r--r--api/alternative-API-structure.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/api/alternative-API-structure.md b/api/alternative-API-structure.md
index fc97698..483a0e4 100644
--- a/api/alternative-API-structure.md
+++ b/api/alternative-API-structure.md
@@ -364,6 +364,25 @@ _______________________________
I question whether a scripting API should return a 404 in HTML on a failed query.
An error response wrapped in valid JSON would seem to be much more useful.
+This is already implemented for some query URLs, for example: `http://genenetwork.org/api/v_pre1/groups/rubbish`
+```
+{
+ "errors": [
+ {
+ "detail": "",
+ "source": {
+ "pointer": "/api/v_pre1/groups/<path:species_name>"
+ },
+ "status": 204,
+ "title": "No Results"
+ }
+ ]
+}
+
+```
+Although I think the returned status should be **`400 Bad Request`**.
+A list of correct possible responses (for the error at the highest hierarchichal level) could be included, as well as a template for correct syntax.
+
<hr>
## Wishlist