rest client and server code