EIDA / mediatorws

EIDA NG Mediator/Federator web services
GNU General Public License v3.0
6 stars 6 forks source link

fed, stl: HTTP status code 422 on Schema validation errors #9

Closed damb closed 6 years ago

damb commented 6 years ago

federator returns HTTP status code 422 on validation errors:

damb@ansilta:~/tmp$ wget -O data -v "http://localhost:5000/fdsnws/dataselect/1/query?start=2017-01-01&end=2017-01-02T12:12:12&cha=LH?&sta=BFO,DAVOXa"
--2017-12-08 16:34:37--  http://localhost:5000/fdsnws/dataselect/1/query?start=2017-01-01&end=2017-01-02T12:12:12&cha=LH?&sta=BFO,DAVOXa
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:5000... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:5000... connected.
HTTP request sent, awaiting response... 422 UNPROCESSABLE ENTITY
2017-12-08 16:34:37 ERROR 422: UNPROCESSABLE ENTITY.
damb commented 6 years ago

Will be fixed as soon as we focus on logging/exception handling.

damb commented 6 years ago

See also:

damb commented 6 years ago

The discussion regarding error/exception handling will continue at #21.

damb commented 6 years ago

Duplicate of #21.

damb commented 6 years ago

Webservices should abort and return HTTP status code 400 for improper formated query e.g.

$ wget -O - "http://mediator-devel.ethz.ch/fdsnws/station/1/query?foo=--&minlat=48&maxlat=49&net=GR&service=station&format=text"

Currently unknown request parameters are ignored and the request is processed as

$ wget -O - "http://mediator-devel.ethz.ch/fdsnws/station/1/query?minlat=48&maxlat=49&net=GR&service=station&format=text"

Check webargs to implement a proper solution.

damb commented 6 years ago

Implemented with 77cfb2a. In addition, also stationlite provides a nodata query parameter. eidaws-wfcatalog however still uses exclusively HTTP status code 204. @Jollyfant : Did you ever think about adding the nodata query parameter to eidaws-wfcatalog?

Jollyfant commented 6 years ago

Hi @damb, have considered it but probably won't implement it. IMO 204 is always the appropriate status code for no content.

kaestli commented 6 years ago

(also it is not part of the wfcatalog specification v. 0.22)

damb commented 6 years ago

Hi @Jollyfant,

ok thanks, that's fine for me. I read the specs. I just was wondering why it's not part of it.