ua-snap / data-api

SNAP data API
MIT License
4 stars 0 forks source link

Removal of route synonyms #137

Open BobTorgerson opened 2 years ago

BobTorgerson commented 2 years ago

We likely want to remove route synonyms from our API routes as a part of housecleaning. For example, we discovered that due to the permafrost.py routes containing: @routes.route("/permafrost/protectedarea/") @routes.route("/groundtemperature/protectedarea/") @routes.route("/activelayer/protectedarea/") @routes.route("/magtalt/protectedarea/") @routes.route("/alt/protectedarea/") @routes.route("/magt/protectedarea/")

But only the /permafrost/protectedarea/ being defined, my code for re-caching Varnish was looking at the undefined endpoints and attempting to run them. This normally wouldn't have been anything but a 404 or possibly 500 error as those are not defined, but due to the fact that we have a variable starting endpoint using for /temperature, /precipitation, and /taspr in the taspr.py https://github.com/ua-snap/data-api/blob/f9130b2f43b19f5c9a8df9fb898ad3396b63158e/routes/taspr.py#L732 we are seeing those undefined routes attempted to be run for all of those additional routes above and hitting 503 errors when things go wrong (as they are not expected to use those routes).

Here is an example of that: http://localhost:5000/activelayer/huc/19060202

Bruce suggests we simplify as much as possible and try not to have too many "synonyms" for the same function where it makes sense.

charparr commented 1 month ago

Close this ticket when we have verified that the following endpoints have been de-synonym'd