API - Basic API calls

you need to refactor this function using your new helper above and use only passed variables into the SQL query