add api pre/post handlers and simplify interface to allow only one handler per action and resource