connecting to the api server