Hiking Project Logo

API fetch request sometimes doesn't return anything


Original Post
Dan Farrell · · Unknown Hometown · Joined Dec 2017 · Points: 0

I have a fetch request set up like this:

https://www.hikingproject.com/data/get-trails?lat=${this.state.latitude}&lon=${this.state.longitude}&maxDistance=20&maxResults=10&key="myaccesskey"

and sometimes it returns trails, and sometimes it doesn't.  The response code is 200, it says it was a successfully request, but the array is empty.  Any assistance is much appreciated!

Rachel Vecchitto · · Boulder, CO · Joined Nov 2011 · Points: 280

Hey Dan - Any chance you can give me an example of a lat / lon that returns empty data where you expect non-empty data? Would be helpful in debugging. Thanks!

Dan Farrell · · Unknown Hometown · Joined Dec 2017 · Points: 0

Hey Rachel!

I used the example one, latitude: -40, longitude: 105.  

Dan Farrell · · Unknown Hometown · Joined Dec 2017 · Points: 0

I use the same coordinates every time, when testing new styling/display features.  Sometimes it works, sometimes it doesn't haha

Rachel Vecchitto · · Boulder, CO · Joined Nov 2011 · Points: 280

Sorry for the delayed response. I haven't been able to replicate the issue you've been seeing... let me know if you're still having issues with it, otherwise I'm not sure there's a bug here.

Guideline #1: Don't be a jerk.

Post a Reply to "API fetch request sometimes doesn't return anyt…"
in the Hiking Project Feedback & Suggestions

Log In to Reply