refactored endpoint/api URI builder