Updated api module

  Added optional username and password to all methods
  Fixed #203
  Fixed #201
Merge pull request #208 from lechat/fix_api

Updated api module