Updated api module

  Added optional username and password to all methods
  Fixed #203
  Fixed #201