pass response object to callback method in restEndpoint