refactor api helpers

refactored api helper.