Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid requests to sensor network endpoints return 400 Bad Request and JSON error if there are no matching results #316

Open
brlodi opened this issue Jul 17, 2017 · 0 comments

Comments

@brlodi
Copy link
Collaborator

brlodi commented Jul 17, 2017

Requests against sensor network endpoints, like sensor-networks/array_of_things_chicago/features or sensor-networks/array_of_things_chicago/sensors, return a 400 Bad Request header and an error JSON response if they fail to find any matching items. Example, in the middle of the lake:

http://plenar.io/v1/api/sensor-networks/array_of_things_chicago/sensors?geom=%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B-87.40533828735352%2C42.44778143462245%5D%2C%5B-87.40533828735352%2C42.601619944327965%5D%2C%5B-86.49347305297852%2C42.601619944327965%5D%2C%5B-86.49347305297852%2C42.44778143462245%5D%2C%5B-87.40533828735352%2C42.44778143462245%5D%5D%5D%7D%7D

This is in contrast to the event/shape endpoints, which return a success with an empty array of objects, and is also an incorrect application of the 400 status code because there was nothing wrong with the client's request. We just don't have any results to give them.

This is driving a significant amount of custom handling in the Explorer redesign, and masks any actual failures since we're having to swallow all of these AJAX errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant