-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Summary
The GET datasets endpoint takes a JSON-format filter query parameter. The error message for typos in this json is very uninformative.
Steps to Reproduce
Here is an example call with the invalid filter { "limits": {"limit": 1},} (note the extra trailing comma):
curl -X 'GET' \
'https://scicat.development.psi.ch/api/v3/datasets?filter=%7B%20%22limits%22%3A%20%7B%22limit%22%3A%201%7D%2C%7D' \
-H 'accept: application/json' \
-H "Authorization: Bearer $SCICAT_TOKEN"It also occurs with /api/v4/datasets?filter=. I wouldn't be surprised if this was a general issue with all calls that take JSON query parameters.
Current Behaviour
Currently this produces a 500 error with the generic error message "Internal server error".
Expected Behaviour
It should give a more informative error message, eg "Unable to parse filter JSON"
Details
This is somewhat mitigated on /api/v4/datasets when submitting through swagger because the swagger API validates the schema, so it won't let you submit invalid json. Unfortunately /api/v3/datasets doesn't validate the schema (should this be a separate bug?) so it's easy to make typos in long filter queries.