Change retrieval of API endpoint

Retrieve API endpoint through environmental variable.