introduce simple builder for rest endpoint. Remove old redundant code