API: Refactored courses get function to generic get function