Simplify calling API method

in this commit, i refactor some of your code, and make it simpler and easy to use. Please review this