defined generic endpoint function, and test