added support for authentication
fixed endpoint parameter