Sample code for REST client
(cherry picked from commit adbf775)