Writing a REST client