translated most of the pipe api code to REST over CGI