Tests added for api calls

api updated with tests

Fixed lint issues

Added some changes

Added tests

Fixed lint

Changed api code and updated tests for it

logging warning added
Merge pull request #471 from sammyshj/apipart1