Updated to support HTTP basic authentication and HTTPS API URL