azavea / ism-watershed-wellness-snapshot

A tool to collect and display watershed wellness indicators for the International Seaport Museum
1 stars 2 forks source link

Use special endpoint for waterservices data > 120 days #121

Closed fungjj92 closed 4 years ago

fungjj92 commented 4 years ago

Overview

We were seeing failing requests (403 error code) to the waterservices API. Upon investigation of USGS documentation, local testing, and talking with IT at USGS, we now know that requests for data from the waterservices API older than 120 days should be requested from the url prefixed 'nwis'. Otherwise, the request gets redirected to a different origin (waterservices to nwis.waterservices) and the app encounters CORS issues in the browser. The CORS failure is sneakily masquerading as the 403.

In discussion with USGS, we clarified some other details that I'll note here:

Demo

Screen Shot 2020-01-16 at 2 24 16 PM

Using the un-prefixed URL:

Screen Shot 2020-01-16 at 2 24 34 PM

Testing Instructions

Open the netlify build on this PR. Refresh wildly and ensure the API requests come back successfully each time.