Implementation of a generic API caller and a simple login method.