Fixed api tests
Added support for api urls
Improved unit tests