From a398dd9d2642a1732cd9b415150f211040af76d5 Mon Sep 17 00:00:00 2001 From: rupertoverall Date: Wed, 28 Jun 2023 05:48:50 +0200 Subject: Edit 'error catching' section --- api/alternative-API-structure.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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/" + }, + "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. +
## Wishlist -- cgit v1.2.3