prepare rest connection