utility function for calling REST backend