added ability to dynamically determine the endpoint to fetch from